Author Topic: fog: Add fog to your map !  (Read 1325 times)

MetalZelda

  • Hero Member
  • *****
  • Posts: 504
    • View Profile
fog: Add fog to your map !
« on: February 07, 2017, 11:41:33 pm »
**Better Map Fog
Creation Date: Feb. 7 2016
Credits needed: You're free to decide by yourself.
Version: 1.3
Script needed:Multiple events by Christopho -> http://forum.solarus-games.org/index.php/topic,784.0.html

Version Changelog

Code: [Select]
--1.0--
Initial code
Can draw and move a surface, as well as setting the opacity
Method: Using map.dat

Code: [Select]
--1.1--
Bugfix: Strange behaviour on movement (movement not stopped, cutted surface), use a² = b² + c² and then root square it for surface's diagonal movement
Added: Opacity modulation
Method: Same as 1.0


Code: [Select]
--1.2--
Code has been revamped, data is loaded through a Lua file
Added: Surface coloration
Added: Surface blend mode modifer
Method: Parsing from maps/lib/fog_config.lua

Code: [Select]
--1.3--
Bugfix: Error when going on a map where there is no fog data

You might remember my very old map script that wander around the Development section, I've decided to update it, simpler, cleaner yet it is more efficient.
My idea for this update is straightly taken from RPG Maker, you know, there is a GUI that allows you to select your fog, movement and opacity, and The Legend of Zelda: Minish Cap (Fire Cave Dungeon) this simply is the same idea, but instead, it is in pure Lua.

**Documentation and technical presentation
In older version, fogs were drawn using a menu, and constantly cleaned and redrawn on each map changes.
Plus, you had to call a function to declare this fog, this was very annoying.
This method is way simpler, as it use the default map functions, no need to call a function to draw a fog anymore.

** Script calls
In order to make this script to work, you need:

1. A map metatable script
This is my map_metatable.lua header
Code: Lua
  1.   --
  2.   local map_metatable = sol.main.get_metatable("map")
  3.   require("scripts/fog")(map_metatable)
  4.   --
  A child's play !

2. This script (See bellow) that you place in the /script folder (create it if it doesn't exist)
3. The "fog_config.lua" sccript in /maps/lib/ 

** Known bug
All fixed.

** How to use:
  //The best is to have a map metatable
 
  This is my map_metatable.lua header to load this script.
  --
  local map_metatable = sol.main.get_metatable("map")
  require("scripts/fog")(map_metatable)
  --
 
  See ? It's child's play!

** I want to draw a fog, teach me, master

This is the base that you need to learn in order to draw a fog / move it / play with it's opacity

Code: Lua
  1. ["map_id"]= {
  2.   fog                     = "fog",
  3.   fog_speed               = speed,
  4.   fog_angle               = angle,
  5.   fog_opacity             = opacity,
  6.   fog_depth               = use_depth,
  7.   fog_detph_multiplier    = depth_multiplier,
  8.   fog_opacity_range       = opacity_range,
  9.   fog_opacity_wait_time   = opacity_wait_time,
  10.   fog_opacity_update_time = opacity_update_time,
  11.   fog_color = {r, g, b, a},
  12.   fog_blend_mode = "blend_mode",
  13. },
  14.        
  15. Description
  16.        
  17. "map_id"        (String)     = The id of your map, shorter, it's file name
  18. "fog"           (String)     = The fog bitmap located in /sprites/fogs{
  19. speed           (Integer)    = The speed of your fog (0 = static, 999 = very fast, don't go above 999 or else it will crash)
  20. angle           (Integer)    = Number between 0 and 7 where 0 = east and 7 = south-east (counter clockwise)
  21. opacity         (Integer)    = The opacity of your fog, must be a valid number between 0 and 255
  22.  
  23. --Optionnal
  24. use_depth (Boolean) = Use a depth effect (optionnal), value must be booleans (true or false) or nil
  25. depth_multiplier (Integer) = By default the depth multiply the movement by 1.5 to simulate faster fog movement when you move around, you can change this value (optionnal), value can be decimals and negative.
  26. opacity_range (Table) = Range that determine the maximum and minimum opacity, must be a table value, with 2 values (minimum and maximum opacity)
  27. opacity_wait_time (Integer) = Waiting time before the transition between max / min opacity and vice versa
  28. opacity_update_time (Integer) = Waiting time between opacity +/-1
  29. color  (Table) = Color (red, green, blue and alpha (transparency), values must be between 0 and 255)
  30. blend_mode (String) = Set the fog's blend mode, see Solarus' method of applying blend modes for surfaces (http://www.solarus-games.org/doc/latest/lua_api_drawable.html#lua_api_drawable_set_blend_mode)
  31.  
   
Example, I wanna display a fog in the map with the id "Dungeon7"
Code: Lua
  1. ["Dungeon7"]= {
  2.   fog = "forest_fog",
  3.   fog_speed = 10,
  4.   fog_angle = 3,
  5.   fog_opacity = 75,
  6. },
   
Another example: I want to draw a static image on the map with the id "forest"
Code: Lua
  1. ["forest"]= {
  2.   fog = "forest_cloud",
  3.   fog_speed = 0,
  4.   fog_angle = 0,
  5.   fog_opacity = 75,
  6. },

You can even use the Depth multiplier, if you don't set any value to it through fog_depth_multiplier, it's default value will be 1.5, yet you can specify your own value, even negative
Code: Lua
  1. ["forest"]= {
  2.   fog = "forest_cloud",
  3.   fog_speed = 0,
  4.   fog_angle = 0,
  5.   fog_opacity = 75,
  6.   fog_depth = true
  7. },
   
Now, let's assume we're on a Fire Temple, we want a foggy thing with changing opacity, you can even use the Fog depth.
We can change the Opacity
   
Code: Lua
  1. ["FireTemple_Room8"]= {
  2.   fog = "fire_fog",
  3.   fog_speed = 0,
  4.   fog_angle = 0,
  5.   fog_opacity = 75,
  6.   fog_opacity_range = {50, 110},
  7.   fog_opacity_wait_time = 1000,
  8.   fog_opacity_update_time = 10,
  9. },
The opacity will change each 10ms (1 frame)
When the max or minimum opacity has been reached, defined in fog_opacity_range, the script will pause for 1000 ms (1 sec) before resumine
   
Remember, this happen only in maps/lib/fog_config.lua
So, if you want to declare a fog
   
Code: Lua
  1. local fogs = {
  2.   ["FireTemple_Room8"]= {
  3.     fog = "fire_fog",
  4.     fog_speed = 0,
  5.     fog_angle = 0,
  6.     fog_opacity = 75,
  7.     fog_opacity_range = {50, 110},
  8.     fog_opacity_wait_time = 1000,
  9.     fog_opacity_update_time = 10,
  10.   },
  11.  
  12.   ["forest"]= {
  13.     fog = "forest_cloud",
  14.     fog_speed = 0,
  15.     fog_angle = 0,
  16.     fog_opacity = 75,
  17.   },
  18. }
  19.  
  20. return fogs


**The Script
Code: Lua
  1. return function(map)
  2. --[[
  3. ** Better map fog script
  4. ** Creation Date: Feb. 7 2016
  5. ** Credits needed: You're free to decibe by yourself.
  6.  
  7. ** Script depencies:
  8.   Multi events by Christopho (http://forum.solarus-games.org/index.php/topic,784.0.html)
  9.  
  10. ** What you need:
  11.   Create a folder in /sprites called "fogs" and place your fogs bitmap here.
  12.   Create a file called fog_config.lua in the "maps/lib" folder, and in this file, copy/paste this
  13.  
  14.  
  15.   local fogs = {
  16.  
  17.   }
  18.   return fogs
  19.  
  20.   This is the base of this script,
  21.  
  22. ** How to use:
  23.   //The best is to have a map metatable
  24.  
  25.   This is my map_metatable.lua header
  26.   --
  27.   local map_metatable = sol.main.get_metatable("map")
  28.   require("scripts/fog_manager")(map_metatable)
  29.   --
  30.  
  31.   See ? It's child's play!
  32.  
  33. ** Tutorial: Displaying a fog
  34.  
  35.   This is the whole things you need to know about this script.
  36.        
  37.         ["map_id"]= {
  38.           fog                     = "fog",
  39.           fog_speed               = speed,
  40.           fog_angle               = angle,
  41.           fog_opacity             = opacity,
  42.           fog_depth               = use_depth,
  43.           fog_detph_multiplier    = depth_multiplier,
  44.           fog_opacity_range       = {opacity_range},
  45.           fog_opacity_wait_time   = opacity_wait_time,
  46.           fog_opacity_update_time = opacity_update_time,
  47.           fog_color               = {r, g, b, a}
  48.         },
  49.        
  50.         Description
  51.        
  52.                                 "map_id"            (String)     = The id of your map, shorter, it's file name
  53.                                 "fog"               (String)     = The fog bitmap located in /sprites/fogs{
  54.                             speed               (Integer)    = The speed of your fog (0 = static, 999 = very fast, don't go above 999 or else it will crash)
  55.                     angle               (Integer)    = Number between 0 and 7 where 0 = east and 7 = south-east (counter clockwise)
  56.                     opacity             (Integer)    = The opacity of your fog, must be a valid number between 0 and 255
  57.         (Optionnal) use_depth           (Boolean)    = Use a depth effect (optionnal), value must be booleans (true or false) or nil
  58.         (Optionnal) depth_multiplier    (Integer)    = By default the depth multiply the movement by 1.5 to simulate faster fog movement when you move around, you can change this value (optionnal), value can be decimals and negative.
  59.         (Optionnal) opacity_range       (Table)      = Range that determine the maximum and minimum opacity, must be a table value, with 2 values (minimum and maximum opacity)
  60.         (Optionnal) opacity_wait_time   (Integer)    = Waiting time before the transition between max / min opacity and vice versa
  61.         (Optionnal) opacity_update_time (Integer)    = Waiting time between opacity +/-1
  62.         (Optionnal) color               (Table)      = Color (red, green, blue and alpha (transparency), values must be between 0 and 255)
  63.     (Optionnal) blend_mode          (String)     = Set the fog's blend mode, see Solarus' method of applying blend modes for surfaces (http://www.solarus-games.org/doc/latest/lua_api_drawable.html#lua_api_drawable_set_blend_mode)
  64.  
  65.        
  66.         Example, I wanna display a fog in the map with the id "Dungeon7"
  67.         ["Dungeon7"]= {
  68.           fog                     = "forest_fog",
  69.           fog_speed               = 10,
  70.           fog_angle               = 3,
  71.           fog_opacity             = 75,
  72.         },
  73.        
  74.         Another example: I want to draw a static image on the map with the id "forest"
  75.         ["forest"]= {
  76.           fog                     = "forest_cloud",
  77.           fog_speed               = 0,
  78.           fog_angle               = 0,
  79.           fog_opacity             = 75,
  80.         },
  81.        
  82.         You can even use the Depth multiplier, if you don't set any value to it through fog_detph_multiplier, it's default value will be 1.5, yet you can specify
  83.         your own value, even negative
  84.         ["forest"]= {
  85.           fog                     = "forest_cloud",
  86.           fog_speed               = 0,
  87.           fog_angle               = 0,
  88.           fog_opacity             = 75,
  89.           fog_depth               = true
  90.         },
  91.        
  92.         Now, let's assume we're on a Fire Temple, we want a foggy thing with changing opacity, you can even use the Fog depth.
  93.         We can change the Opacity
  94.        
  95.         ["FireTemple_Room8"]= {
  96.           fog                     = "fire_fog",
  97.           fog_speed               = 0,
  98.           fog_angle               = 0,
  99.           fog_opacity             = 75,
  100.           fog_opacity_range       = {50, 110}
  101.           fog_opacity_wait_time   = 1000
  102.           fog_opacity_update_time = 10
  103.         },
  104.        
  105.         Remember, this happen only in maps/lib/fog_config.lua
  106.        
  107.         So, if you want to declare a fog
  108.        
  109.         local fogs = {
  110.           ["FireTemple_Room8"]= {
  111.             fog                     = "fire_fog",
  112.             fog_speed               = 0,
  113.             fog_angle               = 0,
  114.             fog_opacity             = 75,
  115.             fog_opacity_range       = {50, 110}
  116.             fog_opacity_wait_time   = 1000
  117.             fog_opacity_update_time = 10
  118.           },
  119.        
  120.        
  121.         }
  122.        
  123.         return fogs
  124. ]]
  125.  
  126.   local movement
  127.   local opacity_state = 0
  128.   local fog_data = require("maps/lib/fog_config")
  129.  
  130.   local function load_map(map_id)
  131.     local fog = {}
  132.            
  133.     -- This map was not found while parsing the fog config
  134.     if fog_data[map_id] == nil then
  135.       return
  136.     end
  137.  
  138.     local map = fog_data[map_id]
  139.         if map ~= nil then
  140.           fog[1] = {
  141.                 fog                   = map.fog,
  142.         fog_speed             = map.fog_speed,
  143.                 fog_angle             = map.fog_angle,
  144.                 fog_opacity           = map.fog_opacity,
  145.                 fog_depth             = map.fog_depth,
  146.                 fog_depth_multiplier  = map.fog_detph_multiplier,
  147.                 fog_opacity_range     = map.fog_opacity_range,
  148.                 fog_opacity_wait_time = map.fog_opacity_wait_time,
  149.                 fog_opacity_update    = map.fog_opacity_update_time,
  150.                 fog_color             = map.fog_color,
  151.                 fog_blend_mode        = map.fog_blend_mode
  152.           }
  153.         end
  154.        
  155.     return fog
  156.   end
  157.  
  158.   local function update_opacity_surface(map)
  159.     -- No opacity range, no need to continue
  160.     if map.fog_opacity_r == nil then
  161.           return
  162.         end
  163.        
  164.     local minimum, maximum = map.fog_opacity_r[1], map.fog_opacity_r[2]
  165.         sol.timer.start(map, map.fog_opacity_u, function()
  166.           local opacity = map.fog:get_opacity()
  167.           local new_opacity = opacity_state == 0 and 1 or -1
  168.          
  169.           if opacity == (opacity_state == 0 and maximum or minimum) then
  170.                 sol.timer.start(map, map.fog_opacity_w, function()
  171.                   opacity_state = opacity_state == 0 and 1 or 0
  172.                   update_opacity_surface(map)
  173.                 end)
  174.             return
  175.           end
  176.                
  177.           map.fog:set_opacity(opacity + new_opacity)
  178.                
  179.           return opacity ~= (opacity_state == 0 and maximum or minimum)
  180.         end)
  181.   end
  182.  
  183.   -- Update the movement
  184.   local function compute_movement(map)
  185.     map.fog:set_opacity(map.fog_opacity)
  186.         local fog_size_x, fog_size_y = map.fog:get_size()
  187.        
  188.         -- No speed, no need to continue
  189.         if map.fog_speed == 0 then
  190.           return
  191.         end
  192.        
  193.     local fog_angle = map.fog_angle
  194.         -- Get the Max movement in order to determine the max distance
  195.         -- Diagonal is determined by Pythagorean theorem a² = b² + c²
  196.         local diagonal = math.sqrt((fog_size_x * fog_size_x) + (fog_size_y * fog_size_y))
  197.         local angle = {
  198.           fog_size_x,
  199.           fog_size_y,
  200.           fog_size_x,
  201.           fog_size_y,
  202.         }
  203.        
  204.         local max_distance =  fog_angle > 0 and angle[fog_angle / 2] or 0
  205.         if fog_angle % 2 ~= 0 then
  206.           max_distance = diagonal
  207.         end
  208.  
  209.         function restart_overlay_movement()
  210.           movement = sol.movement.create("straight")
  211.           movement:set_speed(map.fog_speed)
  212.           movement:set_max_distance(max_distance)
  213.           movement:set_angle(fog_angle * math.pi / 4)
  214.           movement:start(map.fog, function()
  215.                 map.fog:set_xy(0, 0)
  216.                 restart_overlay_movement()
  217.           end)
  218.     end
  219.         restart_overlay_movement()
  220.   end
  221.  
  222.   map:register_event("on_started", function(map)
  223.     local data = load_map(map:get_id())
  224.        
  225.         if movement ~= nil then
  226.           movement:stop()
  227.         end
  228.  
  229.         if data == nil then
  230.           return
  231.         end
  232.        
  233.     for _, fog in ipairs(data) do
  234.           map.fog           = sol.surface.create("fogs/".. fog.fog ..".png")
  235.           map.fog_speed     = fog.fog_speed
  236.           map.fog_opacity   = fog.fog_opacity
  237.           map.fog_angle     = fog.fog_angle
  238.           map.fog_depth     = fog.fog_depth
  239.           map.fog_depth_mvt = fog.fog_depth_multiplier ~= nil and fog.fog_depth_multiplier or 1.5
  240.           map.fog_opacity_r = fog.fog_opacity_range
  241.           map.fog_opacity_w = fog.fog_opacity_wait_time
  242.           map.fog_opacity_u = fog.fog_opacity_update
  243.          
  244.           if fog.fog_blend_mode ~= nil then
  245.             map.fog:set_blend_mode(fog.fog_blend_mode)
  246.           end
  247.          
  248.           if fog.fog_color ~= nil then
  249.             map.fog:fill_color(fog.fog_color)
  250.           end
  251.          
  252.           break
  253.         end
  254.        
  255.        
  256.  
  257.         compute_movement(map)
  258.         update_opacity_surface(map)
  259.   end)
  260.  
  261.   map:register_event("on_draw", function(map, dst_surface)
  262.     local scr_x, scr_y = dst_surface:get_size()
  263.        
  264.     if map.fog ~= nil then
  265.           local x, y = map:get_camera():get_bounding_box()
  266.           local overlay_width, overlay_height = map.fog:get_size()
  267.          
  268.           if map.fog_depth ~= nil then
  269.             x, y = -math.floor(x * map.fog_depth_mvt), -math.floor(y * map.fog_depth_mvt)
  270.           else
  271.             x, y = -math.floor(x), -math.floor(y)
  272.           end
  273.  
  274.           x = x % overlay_width  - 2 * overlay_width
  275.           y = y % overlay_height - 2 * overlay_height
  276.          
  277.           local dst_y = y
  278.           while dst_y < scr_y + overlay_height do
  279.             local dst_x = x
  280.             while dst_x < scr_x + overlay_width do
  281.               map.fog:draw(dst_surface, dst_x, dst_y)
  282.                   dst_x = dst_x + overlay_width
  283.             end
  284.             dst_y = dst_y + overlay_height
  285.           end
  286.     end
  287.   end)
  288. end

Small example, Cloud.

Code: [Select]
  fog = "overworld_smallcloud",
  fog_speed = 10,
  fog_angle = 3,
  fog_opacity = 75,

This is how it will looks (minus the tone)



NO ! NO !



Another example: a static image

Parameters

Code: [Select]
  fog = "forest",
  fog_angle = 0,
  fog_speed = 0,
  fog_opacity = 150,



 
Code: Lua
  1.  ["normal/Dungeon/GoronSanctuary/boss/boss"] = {
  2.     fog                     = "fire_mist",
  3.         fog_speed               = 10,
  4.         fog_angle               = 7,
  5.         fog_opacity             = 70,
  6.         fog_depth               = true,
  7.         fog_detph_multiplier    = nil,
  8.         fog_opacity_range       = {40, 110},
  9.         fog_opacity_wait_time   = 1000,
  10.         fog_opacity_update_time = 10
  11.   },

Give this !
https://www.youtube.com/watch?v=36m3gcFFWao

Code: Lua
  1.   ["normal/Dungeon/GoronSanctuary/boss/boss"] = {
  2.     fog                     = "fire_mist",
  3.         fog_speed               = 10,
  4.         fog_angle               = 7,
  5.         fog_opacity             = 70,
  6.         fog_depth               = true,
  7.         fog_detph_multiplier    = nil,
  8.         fog_opacity_range       = {40, 110},
  9.         fog_opacity_wait_time   = 1000,
  10.         fog_opacity_update_time = 10,
  11.         fog_color               = {255, 0, 0, 150},
  12.   },

Give this :
https://www.youtube.com/watch?v=yia2Xy_U3_g
« Last Edit: February 09, 2017, 10:31:50 pm by MetalZelda »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1041
    • View Profile
Re: fog: Add fog to your map !
« Reply #1 on: February 08, 2017, 08:56:50 am »
- Lua is not an acronym and should not be written in capital letters.
- You can't change the format of .dat files. If the user open the map with the quest editor, changes it and saves it again, your additional stuff will disappear. Just put the fog information in an external script file instead.
- require("scripts/fog")(map_metatable) is weird. Just do require("scripts/fog"). And it is the job of that script to get the map metatable if they want. When you need to pass a paramater to some external script, do it with a proper function:
Code: Lua
  1. local fog_manager = require("scripts/fog")
  2. fog_manager:my_function(some_parameter)
  3.  

MetalZelda

  • Hero Member
  • *****
  • Posts: 504
    • View Profile
Re: fog: Add fog to your map !
« Reply #2 on: February 08, 2017, 11:07:21 am »
- Lua is not an acronym and should not be written in capital letters.
- You can't change the format of .dat files. If the user open the map with the quest editor, changes it and saves it again, your additional stuff will disappear. Just put the fog information in an external script file instead.
- require("scripts/fog")(map_metatable) is weird. Just do require("scripts/fog"). And it is the job of that script to get the map metatable if they want. When you need to pass a paramater to some external script, do it with a proper function:
Code: Lua
  1. local fog_manager = require("scripts/fog")
  2. fog_manager:my_function(some_parameter)
  3.  

Well then, it's gonna be fixed in the next update  :)
I can already say that the way to make a fog already changed inthe update, all fogs are loaded from a single file

Code: Lua
  1. fogs{
  2.   --[[
  3.     Data for the fog to display on a specific maps
  4.     The format for declaring and displaying a fog for a map is the following
  5.        
  6.     ["map_id"]= {"fog", speed, angle, opacity, use_depth, depth_multiplier},
  7.  
  8.     You can edit these value while playing, the script is reloaded when a map start.
  9.   ]]
  10.  
  11.   ["unplayable/titlescreen"] = {"forest", 0, 0, 75, true, 1.5},
  12.   ["Dungeon9"] = {"fire_mist", 10, 3, 50},
  13. }
« Last Edit: February 08, 2017, 02:22:47 pm by MetalZelda »

Diarandor

  • Hero Member
  • *****
  • Posts: 758
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: fog: Add fog to your map !
« Reply #3 on: February 08, 2017, 04:48:40 pm »
Small example, Cloud.

Code: [Select]
  fog = "overworld_smallcloud",
  fog_speed = 10,
  fog_angle = 3,
  fog_opacity = 75,

This is how it will looks (minus the tone)



NO ! NO !

LOL!!! ;D
This confirms that all great devs are crazy, hehehe! :D

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1041
    • View Profile
Re: fog: Add fog to your map !
« Reply #4 on: February 08, 2017, 05:28:28 pm »
Why don't you keep the same format as in your previous message? The syntax was great, what was wrong was just do to it in the map .dat file. String keys are more readable:
Code: Lua
  1. local fogs = {
  2.   ["unplayable/titlescreen"] = {
  3.     fog = "forest",
  4.     angle = 0,
  5.     speed = 0,
  6.     opacity = 75,
  7.     use_depth = true,
  8.     depth_multiplier = 1.5
  9.   },
  10. }
  11. return fog
  12.  

Other examples:
https://github.com/solarus-games/zelda-roth-se/blob/dev/data/scripts/dungeons.lua
https://github.com/solarus-games/zelda-mercuris-chest/blob/dev/data/scripts/hud/hud_config.lua
https://github.com/solarus-games/zelda-roth-se/blob/dev/data/items/hookshot_config.lua

MetalZelda

  • Hero Member
  • *****
  • Posts: 504
    • View Profile
Re: fog: Add fog to your map !
« Reply #5 on: February 08, 2017, 06:47:59 pm »
Post updated

Version 1.1

Added:
- Depth (optionnal)
- Opacity variation
- Bug fixed

EDIT

Version 1.2

Added:
- Color modifer
- Blend mode modifer

Everything you need to know is in the first post
« Last Edit: February 08, 2017, 08:54:16 pm by MetalZelda »

ffomega

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Solarus Resource & Tutorial Site
Re: fog: Add fog to your map !
« Reply #6 on: July 01, 2017, 02:22:56 pm »
I created a much simpler way to add fog to your maps, using a singular overlay that is built right into my tileset, that uses parallax scrolling.  Simply take it, and (if you like, any one of the semi-transparent tiles located at the top of the tileset, fit it over the entire map, making sure it is on the highest layer, separate from all other tile patterns.  You may choose to make it dynamic (in case you want to have a script attached to it, for instance, creating a fog overlay for before the hero obtains the master swordd, and then having it destroyed or not created when he has it).
My tilesets page can be found here:
http://absolute-hyrule-tutorials.solarus-games.org/

MetalZelda

  • Hero Member
  • *****
  • Posts: 504
    • View Profile
Re: fog: Add fog to your map !
« Reply #7 on: July 02, 2017, 05:11:21 pm »
I created a much simpler way to add fog to your maps, using a singular overlay that is built right into my tileset, that uses parallax scrolling.  Simply take it, and (if you like, any one of the semi-transparent tiles located at the top of the tileset, fit it over the entire map, making sure it is on the highest layer, separate from all other tile patterns.  You may choose to make it dynamic (in case you want to have a script attached to it, for instance, creating a fog overlay for before the hero obtains the master swordd, and then having it destroyed or not created when he has it).

That's another way to use it, this script is for permanent overlays from map creation to map destruction (I might update it one day)
This is also for minish cap styled fog, like sunrays or fire haze (ie. with opacity variation)
But I think both of our methods can be replaced by shaders when this will be possible  :P