Skip to content

Commit

Permalink
Added the map scene where you encountered the boss the first time.
Browse files Browse the repository at this point in the history
Unfortunately, the boss battle sprite isn't ready yet, so you'll
actually encounter a slime instead in the meanwhile.

The event will trigger again and again, as it is WIP.
  • Loading branch information
Yohann Ferreira committed Sep 24, 2012
1 parent dfb4ce4 commit ff93013
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 51 deletions.
4 changes: 3 additions & 1 deletion LICENSES
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
Licenses Licenses
======== ========


Last update: 2012.09.20 Last update: 2012.09.24


This file is listing all the files licenses from the point of the fork This file is listing all the files licenses from the point of the fork
from the Allacrost project. from the Allacrost project.
Expand Down Expand Up @@ -277,6 +277,7 @@ img/sprites/map/enemies/naga_walk.png GPLv2
img/sprites/map/enemies/scorpion_walk.png GPLv2 Allacrost img/sprites/map/enemies/scorpion_walk.png GPLv2 Allacrost
img/sprites/map/enemies/slime_walk.png GPLv2 Allacrost img/sprites/map/enemies/slime_walk.png GPLv2 Allacrost
img/sprites/map/enemies/snake_walk.png GPLv2 Allacrost img/sprites/map/enemies/snake_walk.png GPLv2 Allacrost
img/sprites/map/enemies/wolf_spritesheet.png GPLv2 The Mana World


img/sprites/map/npcs/mak_hound.png GPLv2 Allacrost img/sprites/map/npcs/mak_hound.png GPLv2 Allacrost
img/sprites/map/npcs/mak_hound_mounted.png GPLv2 Allacrost img/sprites/map/npcs/mak_hound_mounted.png GPLv2 Allacrost
Expand Down Expand Up @@ -386,6 +387,7 @@ mus/koertes-ccby-birdsongloop16s.ogg CC by SA 3.0
mus/Soliloquy_1-OGA-mat-pablo.ogg CC by SA 3.0, GPLv3 Mathew Pablo (OGA) mus/Soliloquy_1-OGA-mat-pablo.ogg CC by SA 3.0, GPLv3 Mathew Pablo (OGA)




snd/growl1_IFartInUrGeneralDirection_freesound.wav CC by SA 3.0, GPLv2 or 3 IFartInUrGeneralDirection from freesound.org
snd/itempick2_michel_baradari_oga.wav CC by 3.0 Michel Baradari (OGA) from here: http://www.cubeengine.com/forum.php4?action=display_thread&thread_id=2164 snd/itempick2_michel_baradari_oga.wav CC by 3.0 Michel Baradari (OGA) from here: http://www.cubeengine.com/forum.php4?action=display_thread&thread_id=2164
snd/lightning.wav CC0 (Bertram) snd/lightning.wav CC0 (Bertram)
snd/new_game.wav GPLv2 (Same sound than the opening_sword_fall.wav) file from Allacrost. snd/new_game.wav GPLv2 (Same sound than the opening_sword_fall.wav) file from Allacrost.
Expand Down
39 changes: 27 additions & 12 deletions dat/actors/map_sprites.lua
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ sprites["Squirrel"] = {
-- --------- -- ---------
-- Enemies -- Enemies
-- --------- -- ---------
enemies["slime"] = { sprites["slime"] = {
coll_half_width = 0.6, coll_half_width = 0.6,
coll_height = 1.0, coll_height = 1.0,
img_half_width = 0.6, img_half_width = 0.6,
Expand All @@ -316,7 +316,7 @@ enemies["slime"] = {
} }




enemies["snake"] = { sprites["snake"] = {
coll_half_width = 1.0, coll_half_width = 1.0,
coll_height = 2.0, coll_height = 2.0,
img_half_width = 1.0, img_half_width = 1.0,
Expand All @@ -330,7 +330,7 @@ enemies["snake"] = {
} }




enemies["scorpion"] = { sprites["scorpion"] = {
coll_half_width = 1.0, coll_half_width = 1.0,
coll_height = 2.0, coll_height = 2.0,
img_half_width = 1.0, img_half_width = 1.0,
Expand All @@ -343,6 +343,21 @@ enemies["scorpion"] = {
} }
} }


sprites["Wolf"] = {
name = hoa_system.Translate("Wolf"),
coll_half_width = 1.5,
coll_height = 3.0,
img_half_width = 1.5,
img_height = 3.0,
movement_speed = NORMAL_SPEED,

-- using special animation files.
standard_animations = {
idle = "img/sprites/map/enemies/wolf_idle.lua",
walk = "img/sprites/map/enemies/wolf_walk.lua"
}
}



sprite = {} sprite = {}
enemy = {} enemy = {}
Expand Down Expand Up @@ -476,7 +491,7 @@ end




function CreateEnemySprite(Map, name) function CreateEnemySprite(Map, name)
if (enemies[name] == nil) then if (sprites[name] == nil) then
print("Error: No object named: "..name.." found!!"); print("Error: No object named: "..name.." found!!");
return nil; return nil;
end end
Expand All @@ -490,14 +505,14 @@ function CreateEnemySprite(Map, name)
enemy:SetSpriteName(name); -- The catalog reference enemy:SetSpriteName(name); -- The catalog reference
enemy:SetObjectID(Map.object_supervisor:GenerateObjectID()); enemy:SetObjectID(Map.object_supervisor:GenerateObjectID());
enemy:SetContext(hoa_map.MapMode.CONTEXT_01); enemy:SetContext(hoa_map.MapMode.CONTEXT_01);
enemy:SetCollHalfWidth(enemies[name].coll_half_width); enemy:SetCollHalfWidth(sprites[name].coll_half_width);
enemy:SetCollHeight(enemies[name].coll_height); enemy:SetCollHeight(sprites[name].coll_height);
enemy:SetImgHalfWidth(enemies[name].img_half_width); enemy:SetImgHalfWidth(sprites[name].img_half_width);
enemy:SetImgHeight(enemies[name].img_height); enemy:SetImgHeight(sprites[name].img_height);
enemy:SetMovementSpeed(enemies[name].movement_speed); enemy:SetMovementSpeed(sprites[name].movement_speed);


enemy:LoadStandingAnimations(enemies[name].standard_animations.idle); enemy:LoadStandingAnimations(sprites[name].standard_animations.idle);
enemy:LoadWalkingAnimations(enemies[name].standard_animations.walk); enemy:LoadWalkingAnimations(sprites[name].standard_animations.walk);


return enemy; return enemy;
end end
165 changes: 127 additions & 38 deletions dat/maps/layna_forest/layna_forest_north_east.lua
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -398,9 +398,20 @@ function _CreateCharacters()
Map:AddGroundObject(hero); Map:AddGroundObject(hero);
end end


-- The boss map sprite
local wolf = {};

function _CreateObjects() function _CreateObjects()
local object = {} local object = {}
local npc = {} local npc = {}

-- The boss map sprite
wolf = CreateSprite(Map, "Wolf", 104, 3); -- pre place it at the right place.
wolf:SetCollisionMask(hoa_map.MapMode.NO_COLLISION);
wolf:SetMovementSpeed(hoa_map.MapMode.VERY_FAST_SPEED);
wolf:SetVisible(false);
wolf:SetDirection(hoa_map.MapMode.SOUTH);
Map:AddGroundObject(wolf);


npc = CreateSprite(Map, "Butterfly", 42, 18); npc = CreateSprite(Map, "Butterfly", 42, 18);
npc:SetCollisionMask(hoa_map.MapMode.NO_COLLISION); npc:SetCollisionMask(hoa_map.MapMode.NO_COLLISION);
Expand Down Expand Up @@ -657,29 +668,29 @@ function _CreateObjects()
{ "Tree Small3", 125, 96 }, { "Tree Small3", 125, 96 },


-- going down - left side -- going down - left side
{ "Tree Small3", 107, 20 }, { "Tree Small3", 107, 20 },
{ "Tree Small4", 110, 23 }, { "Tree Small4", 110, 23 },
{ "Tree Small3", 109, 25 }, { "Tree Small3", 109, 25 },
{ "Tree Small5", 111, 28 }, { "Tree Small5", 111, 28 },
{ "Tree Small3", 110, 31 }, { "Tree Small3", 110, 31 },
{ "Tree Small6", 109, 34 }, { "Tree Small6", 109, 34 },
{ "Tree Small3", 108, 36 }, { "Tree Small3", 108, 36 },
{ "Tree Small4", 110, 39 }, { "Tree Small4", 110, 39 },
{ "Tree Small3", 109, 42 }, { "Tree Small3", 109, 42 },
{ "Tree Small4", 111, 45 }, { "Tree Small4", 111, 45 },
{ "Tree Small3", 110, 47 }, { "Tree Small3", 110, 47 },
{ "Tree Small5", 109, 50 }, { "Tree Small5", 109, 50 },
{ "Tree Small3", 110, 53 }, { "Tree Small3", 110, 53 },
{ "Tree Small4", 111, 56 }, { "Tree Small4", 111, 56 },
{ "Tree Small3", 109, 59 }, { "Tree Small3", 109, 59 },
{ "Tree Small4", 110, 62 }, { "Tree Small4", 110, 62 },
{ "Tree Small3", 109, 65 }, { "Tree Small3", 109, 65 },
{ "Tree Small4", 110, 67 }, { "Tree Small4", 110, 67 },
{ "Tree Small3", 109, 70 }, { "Tree Small3", 109, 70 },
{ "Tree Small4", 107, 73 }, { "Tree Small4", 107, 73 },
{ "Tree Small3", 106, 76 }, { "Tree Small3", 106, 76 },
{ "Tree Small4", 104, 79 }, { "Tree Small4", 104, 79 },
{ "Tree Small3", 102, 80 }, { "Tree Small3", 102, 80 },




-- going left - bottom side -- going left - bottom side
Expand Down Expand Up @@ -716,20 +727,20 @@ function _CreateObjects()
{ "Tree Small3", 80, 94 }, { "Tree Small3", 80, 94 },
{ "Tree Small4", 78, 95 }, { "Tree Small4", 78, 95 },


-- going left - top side -- going left - top side
{ "Tree Small3", 98, 82 }, { "Tree Small3", 98, 82 },
{ "Tree Small3", 94, 81 }, { "Tree Small3", 94, 81 },
{ "Tree Small4", 90, 82.5 }, { "Tree Small4", 90, 82.5 },
{ "Tree Small3", 86, 83 }, { "Tree Small3", 86, 83 },
{ "Tree Small5", 82, 82 }, { "Tree Small5", 82, 82 },
{ "Tree Small3", 78, 84 }, { "Tree Small3", 78, 84 },
{ "Tree Small6", 74, 85 }, { "Tree Small6", 74, 85 },

-- going down - top side -- going down - top side
{ "Tree Small4", 70, 87 }, { "Tree Small4", 70, 87 },
{ "Tree Small3", 68, 90 }, { "Tree Small3", 68, 90 },
{ "Tree Small3", 67, 93 }, { "Tree Small3", 67, 93 },
{ "Tree Small5", 66, 96 } { "Tree Small5", 66, 96 }


} }


Expand Down Expand Up @@ -769,23 +780,83 @@ function _CreateEvents()
local dialogue = {}; local dialogue = {};
local text = {}; local text = {};


-- Map events
event = hoa_map.MapTransitionEvent("to forest NW", "dat/maps/layna_forest/layna_forest_north_west.lua", "from_layna_forest_NE"); event = hoa_map.MapTransitionEvent("to forest NW", "dat/maps/layna_forest/layna_forest_north_west.lua", "from_layna_forest_NE");
EventManager:RegisterEvent(event); EventManager:RegisterEvent(event);

-- generic events
event = hoa_map.ScriptedEvent("Map:PopState()", "Map_PopState", "");
EventManager:RegisterEvent(event);

-- Boss fight scene
event = hoa_map.ScriptedEvent("boss fight scene", "start_boss_fight_scene", "");
event:AddEventLinkAtEnd("boss fight pre-dialogue");
EventManager:RegisterEvent(event);

dialogue = hoa_map.SpriteDialogue();
text = hoa_system.Translate("What's that?!...");
dialogue:AddLineEmote(text, hero, "exclamation");
DialogueManager:AddDialogue(dialogue);
event = hoa_map.DialogueEvent("boss fight pre-dialogue", dialogue);
event:AddEventLinkAtEnd("Wolf runs toward the hero");
EventManager:RegisterEvent(event);

event = hoa_map.PathMoveSpriteEvent("Wolf runs toward the hero", wolf, hero, true);
event:AddEventLinkAtEnd("First Wolf battle");
EventManager:RegisterEvent(event);

event = hoa_map.BattleEncounterEvent("First Wolf battle");
event:SetMusic("mus/The_Creature_Awakens.ogg");
event:SetBackground("img/backdrops/battle/forest_background.png");
-- TODO: Add scening script
-- event:AddScript("");
event:AddEnemy(1, 0, 0); -- TODO: Add the wolf once the sprite is done.
event:AddEventLinkAtEnd("Make the wolf disappear");
event:AddEventLinkAtEnd("Map:PopState()");
EventManager:RegisterEvent(event);

event = hoa_map.ScriptedEvent("Make the wolf disappear", "make_wolf_invisible", "");
EventManager:RegisterEvent(event);

end end


-- Create the different map zones triggering events -- Create the different map zones triggering events
function _CreateZones() function _CreateZones()
-- N.B.: left, right, top, bottom -- N.B.: left, right, top, bottom
to_forest_NW_zone = hoa_map.CameraZone(0, 1, 86, 90, hoa_map.MapMode.CONTEXT_01); to_forest_NW_zone = hoa_map.CameraZone(0, 1, 86, 90, hoa_map.MapMode.CONTEXT_01);
Map:AddZone(to_forest_NW_zone); Map:AddZone(to_forest_NW_zone);

to_forest_SE_zone = hoa_map.CameraZone(69, 75, 95, 96, hoa_map.MapMode.CONTEXT_01);
Map:AddZone(to_forest_SE_zone);

-- Fade out music zone - used to set a dramatic area
music_fade_out_zone = hoa_map.CameraZone(48, 50, 8, 17, hoa_map.MapMode.CONTEXT_01);
Map:AddZone(music_fade_out_zone);

boss_fight1_zone = hoa_map.CameraZone(103, 105, 4, 18, hoa_map.MapMode.CONTEXT_01);
Map:AddZone(boss_fight1_zone);
end end


-- Check whether the active camera has entered a zone. To be called within Update() -- Check whether the active camera has entered a zone. To be called within Update()
function _CheckZones() function _CheckZones()
if (to_forest_NW_zone:IsCameraEntering() == true) then if (to_forest_NW_zone:IsCameraEntering() == true) then
hero:SetMoving(false); hero:SetMoving(false);
EventManager:StartEvent("to forest NW"); EventManager:StartEvent("to forest NW");
end elseif (to_forest_SE_zone:IsCameraEntering() == true) then
hero:SetMoving(false);
EventManager:StartEvent("to forest SE");
elseif (music_fade_out_zone:IsCameraEntering() == true) then
-- fade out the music when the first boss fight hasn't been done yet.
if (GlobalManager:DoesEventExist("story", "layna_forest_boss_fight1") == false) then
AudioManager:FadeOutAllMusic(2000);
end
elseif (boss_fight1_zone:IsCameraEntering() == true) then
-- fade out the music when the first boss fight hasn't been done yet.
if (GlobalManager:DoesEventExist("story", "layna_forest_boss_fight1") == false) then
--GlobalManager:SetEventValue("story", "layna_forest_boss_fight1", 1);
EventManager:StartEvent("boss fight scene");
end
end
end end


-- Sets common battle environment settings for enemy sprites -- Sets common battle environment settings for enemy sprites
Expand All @@ -804,5 +875,23 @@ end


map_functions = { map_functions = {


Map_PopState = function()
Map:PopState();
end,

start_boss_fight_scene = function()
Map:PushState(hoa_map.MapMode.STATE_SCENE);
hero:SetMoving(false);
hero:SetDirection(hoa_map.MapMode.NORTH);
-- Play the wolf growling sound
AudioManager:PlaySound("snd/growl1_IFartInUrGeneralDirection_freesound.wav");
wolf:SetVisible(true);
end,

make_wolf_invisible = function()
wolf:SetVisible(false);
wolf:SetPosition(104, 3);
end

} }


35 changes: 35 additions & 0 deletions img/sprites/map/enemies/wolf_idle.lua
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,35 @@
-- Sprite animation file descriptor
-- This file will describe the frames used to load the sprite animations

-- This files is following a special format compared to other animation scripts.

local ANIM_SOUTH = hoa_map.MapMode.ANIM_SOUTH;
local ANIM_NORTH = hoa_map.MapMode.ANIM_NORTH;
local ANIM_WEST = hoa_map.MapMode.ANIM_WEST;
local ANIM_EAST = hoa_map.MapMode.ANIM_EAST;


sprite_animation = {

-- The file to load the frames from
image_filename = "img/sprites/map/enemies/wolf_spritesheet.png",
-- The number of rows and columns of images, will be used to compute
-- the images width and height, and also the frames number (row x col)
rows = 6,
columns = 11,
-- The frames duration in milliseconds
frames = {
[ANIM_SOUTH] = {
[0] = { id = 22, duration = 150 }
},
[ANIM_NORTH] = {
[0] = { id = 33, duration = 150 }
},
[ANIM_WEST] = {
[0] = { id = 17, duration = 150 }
},
[ANIM_EAST] = {
[0] = { id = 8, duration = 150 }
}
}
}
Binary file added img/sprites/map/enemies/wolf_spritesheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ff93013

Please sign in to comment.