Browse files

Made the forest cave map be a bit more spooky.

  • Loading branch information...
1 parent c32a93e commit 9c0109a1b5eb41fede3ed4e069eae17ca25a8de6 Yohann Ferreira committed Oct 29, 2012
View
2 LICENSES
@@ -82,6 +82,8 @@ dat/tilesets/wood-tileset.lua GPLv2 or later
img/ambient/fog.png GPLv2 or later Bertram
img/ambient/sandstorm.png GPLv2 or later The Mana World Team + Bertram
+img/backdrops/cave_background.png CC0 Ecrivain (OGA)
+
img/backdrops/battle/forest_background.png CC by SA 3.0 Tamara Ramsay vectorgurl.com - Ramtam (OGA)
img/backdrops/battle/forest_background_evening.png CC by SA 3.0 Tamara Ramsay vectorgurl.com - Ramtam (OGA)
img/backdrops/battle/desert_cave/desert_cave.png GPLv2 Allacrost + Bertram
View
31 dat/maps/layna_forest/layna_forest_cave1_1.lua
@@ -359,6 +359,9 @@ layers[3][47] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-- the main character handler
local hero = {};
+-- Used as halo around the player
+local light_halo = {};
+
-- the main map loading code
function Load(m)
@@ -382,14 +385,38 @@ function Load(m)
_CreateEvents();
_CreateZones();
- -- Add clouds overlay
- Map:GetEffectSupervisor():EnableAmbientOverlay("img/ambient/clouds.png", 0.0, 0.0, false);
+ -- Add a mediumly dark lightning overlay
+ Map:GetEffectSupervisor():EnableLightingOverlay(hoa_video.Color(0.0, 0.0, 0.0, 0.7));
+ -- Add the background and foreground animations
+ Map:GetScriptSupervisor():AddScript("dat/maps/layna_forest/layna_forest_cave_1_1_background_anim.lua");
+
+ -- Add a halo, following the player to help him see what's near.
+ light_halo = hoa_map.PhysicalObject();
+ light_halo:SetObjectID(Map.object_supervisor:GenerateObjectID());
+ light_halo:SetContext(hero:GetContext());
+ light_halo:SetPosition(hero:GetXPosition() + 1.0, hero:GetYPosition() + 5.0);
+ light_halo:SetCollHalfWidth(7.875);
+ light_halo:SetCollHeight(15.68);
+ light_halo:SetImgHalfWidth(7.875);
+ light_halo:SetImgHeight(15.68);
+ light_halo:AddAnimation("img/misc/lights/torch_light_mask.lua");
+ light_halo:SetCollisionMask(hoa_map.MapMode.NO_COLLISION);
+ light_halo:SetDrawOnSecondPass(true); -- Above any other ground object
+ Map:AddGroundObject(light_halo);
+
+ -- Add a halo showing the cave entrance
+ Map:AddHalo("img/misc/lights/torch_light_mask.lua", 116, 109,
+ hoa_video.Color(1.0, 1.0, 1.0, 0.8), hoa_map.MapMode.CONTEXT_01);
+
end
-- the map update function handles checks done on each game tick.
function Update()
-- Check whether the character is in one of the zones
_CheckZones();
+
+ -- Updates the halo position
+ light_halo:SetPosition(hero:GetXPosition() + 1.0, hero:GetYPosition() + 5.0);
end
-- Character creation
View
76 dat/maps/layna_forest/layna_forest_cave_1_1_background_anim.lua
@@ -0,0 +1,76 @@
+-- Desert cave scripted animation
+
+local ns = {}
+setmetatable(ns, {__index = _G})
+layna_forest_cave_1_1_background_anim = ns;
+setfenv(1, ns);
+
+-- Animation members
+local rock_id = -1;
+local fog_id = -1;
+local animation_id = -1;
+
+-- Fog related members
+local fog_x_position = 300.0;
+local fog_origin_x_position = 300.0;
+local fog_y_position = 500.0;
+local fog_alpha = 0.0;
+local fog_timer;
+local fog_time_length = 8000;
+
+function Initialize(battle_instance)
+ Battle = battle_instance;
+ Script = Battle:GetScriptSupervisor();
+ -- Load the creatures animated background
+ animation_id = Script:AddImage("img/backdrops/cave_background.png", 1024.0, 768.0);
+
+ -- Construct a timer used to display the fog with a custom alpha value and position
+ fog_timer = hoa_system.SystemTimer(fog_time_length, 0);
+ -- Load a fog image used later to be displayed dynamically on the battle ground
+ fog_id = Script:AddImage("img/ambient/fog.png", 320.0, 256.0);
+
+ fog_timer:Run();
+end
+
+
+function Update()
+ -- fog
+ -- Start the timer only at normal battle stage
+ if (fog_timer:IsRunning() == false) then
+ fog_timer:Run();
+ end
+ if (fog_timer:IsFinished()) then
+ fog_timer:Initialize(fog_time_length, 0);
+ fog_timer:Run();
+ -- Make the fog appear at random position
+ fog_x_position = math.random(100.0, 700.0);
+ fog_y_position = math.random(200.0, 550.0);
+ fog_origin_x_position = fog_x_position;
+ fog_alpha = 0.0;
+ end
+ fog_timer:Update();
+ -- update fog position and alpha
+ fog_x_position = fog_origin_x_position - (100 * fog_timer:PercentComplete());
+ if (fog_timer:PercentComplete() <= 0.5) then
+ -- fade in
+ fog_alpha = fog_timer:PercentComplete() * 0.3 / 0.5;
+ else
+ -- fade out
+ fog_alpha = 0.3 - (0.3 * (fog_timer:PercentComplete() - 0.5) / 0.5);
+ end
+end
+
+
+function DrawBackground()
+ -- Draw background animation
+ Script:DrawImage(animation_id, 512.0, 768.0, hoa_video.Color(1.0, 1.0, 1.0, 1.0));
+
+end
+
+
+function DrawForeground()
+ -- Draw a random fog effect
+ Script:DrawImage(fog_id, fog_x_position,
+ fog_y_position,
+ hoa_video.Color(1.0, 1.0, 1.0, fog_alpha));
+end
View
BIN img/backdrops/cave_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN img/tilesets/desert_cave_ground.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9c0109a

Please sign in to comment.