Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Christopho

Pages: [1] 2 3 ... 75
1
Development / Re: Hero state question
« on: August 09, 2018, 11:53:36 pm »
There is no hero:set_state() function because depending on the state you want, there are different parameters needed. Like in the treasure state, you need to specify which treasure you want. For this reason, there are separate functions instead. The one you want is hero:unfreeze(). It unblocks the hero, that is, it restores control to the player.

2
Development / Re: Problem with thrown enemies after pause
« on: August 08, 2018, 06:36:40 pm »
The bug also happens in my games and still with 1.6. I guess we had never noticed before :)
https://gitlab.com/solarus-games/zelda-xd2-mercuris-chess/issues/133

3
Development / Re: Side scrolling functionality
« on: August 08, 2018, 09:11:43 am »
This is a known issue. The side-scrolling script does not support jumping correctly yet.

4
Development / Re: Problem with thrown enemies after pause
« on: August 08, 2018, 09:08:24 am »
Which Solarus version are you using? Which game and which version of that game?

5
Bugs & Feature requests / Re: Complex movements
« on: August 04, 2018, 11:24:38 pm »
More complex example from stdgregwar:
this is the final custcene of Zelda XD2 rewritten with his script.
Code: Lua
  1. -- Final cinematic, but flat
  2. function map:start_cinematic_redux()
  3.   cutscene.builder(game,map,hero)
  4.     .wait(500)
  5.     .dialog('final.zelda_4',player_name)
  6.     .set_direction(hero,1)
  7.     .dontWaitFor.hero_animation('walking')
  8.     .movement{ --movement 1
  9.         type='target',
  10.         entity=hero,
  11.         movement_properties={
  12.           target = {104,192},
  13.           speed = 50,
  14.           smooth = true,
  15.           ignore_obstacles = true,
  16.         }
  17.              }
  18.     .set_direction(hero,0)
  19.     .dontWaitFor.hero_animation('stopped')
  20.     .wait(500)
  21.     .dialog('final.zelda_5',player_name)
  22.     .wait(500)
  23.     .dialog('final.mr_grump_3')
  24.     .wait(500)
  25.     .dialog('final.zelda_6',player_name)
  26.     .set_direction(hero,2)
  27.     .dontWaitFor.hero_animation('walking')
  28.     .movement{--movement 2
  29.         type = 'target',
  30.         entity=hero,
  31.         movement_properties={
  32.           target = {-32,192},
  33.           speed = 80,
  34.           smooth = true,
  35.           ignore_obstacles = true
  36.         }
  37.              }
  38.     .wait(500)
  39.     .set_direction(hero,0)
  40.     .dontWaitFor.hero_animation('carrying_walking')
  41.     .dontWaitFor.sprite_animation(cocktails:get_sprite(),'walking')
  42.     .movement(--movement 3
  43.       {
  44.         type='target',
  45.         entity=hero,
  46.         movement_properties={
  47.           target = {104,192},
  48.           speed = 80,
  49.           smooth = true,
  50.           ignore_obstacles = true
  51.         }
  52.       },
  53.       function(mov)
  54.         function mov:on_position_changed()
  55.           if cocktails then
  56.             local hero_x,hero_y = hero:get_position()
  57.             cocktails:set_position(hero_x,hero_y-16)
  58.           end
  59.         end
  60.       end)
  61.     .dontWaitFor.hero_animation('carrying_stopped')
  62.     .dontWaitFor.sprite_animation(cocktails:get_sprite(),'on_ground')
  63.     .wait(1500)
  64.     .exec(
  65.       function()
  66.         cocktails:remove()
  67.       end)
  68.     .dontWaitFor.hero_animation('stopped')
  69.     .dialog('final.zelda_7',player_name)
  70.     .wait(500)
  71.     .dontWaitFor.hero_animation('dying')
  72.     .wait(2000)
  73.     .dontWaitFor.hero_animation('walking')
  74.     .set_direction(hero,2)
  75.     .movement{--movement 4
  76.         type='target',
  77.         entity=hero,
  78.         movement_properties = {
  79.           target = {-32,192},
  80.           speed = 80,
  81.           smooth = true,
  82.           ignore_obstacles = true
  83.         }
  84.       }
  85.     .wait(1000)
  86.     .dialog('final.zelda_8')
  87.     .wait(500)
  88.     .and_then(
  89.       function(cont)
  90.         fade_sprite = sol.sprite.create('entities/heart_fade')
  91.         local camera_x, camera_y = map:get_camera():get_position()
  92.         local zelda_x, zelda_y = grump_and_zelda:get_position()
  93.         fade_x = zelda_x - camera_x
  94.         fade_y = zelda_y - camera_y - 16
  95.         fade_sprite:set_animation('close',cont)
  96.       end)
  97.     .exec(
  98.       function()
  99.         -- Fill screen with black.
  100.         local quest_w, quest_h = sol.video.get_quest_size()
  101.         black_surface = sol.surface.create(quest_w, quest_h)
  102.         black_surface:fill_color({0, 0, 0})
  103.       end)
  104.     .wait(1000)
  105.     .exec(
  106.       function()
  107.         local menu_font, menu_font_size = language_manager:get_menu_font()
  108.         end_text = sol.text_surface.create{
  109.           horizontal_alignment = "center",
  110.           vertical_alignment = "middle",
  111.           color = {255, 255, 255},
  112.           font = menu_font,
  113.           font_size = menu_font_size * 2,
  114.           text_key = "final.end_text",
  115.         }
  116.       end)
  117.     .wait(2000)
  118.     .exec(
  119.       function()
  120.         -- Launch Ending credits.
  121.         local dialog_box = game:get_dialog_box()
  122.         dialog_box:set_position("bottom")
  123.       end)
  124.     .dialog('final.credits')
  125.     .exec(
  126.       function()
  127.         local statistics = statistics_manager:new(game)
  128.         game:set_suspended(true)
  129.         sol.menu.start(game, statistics)
  130.         function statistics:on_finished()
  131.           -- Reset game.
  132.           sol.main.reset()
  133.         end
  134.       end)
  135.     .start()
  136. end
  137.  

6
General discussion / Re: Text position on top...
« on: August 04, 2018, 08:06:27 pm »
The dialog box script explains how to do that:
Code: Lua
  1. -- - dialog_box:set_position(position):
  2. --   Sets the vertical position of the dialog box for subsequent dialogs.
  3. --   position must be one of:
  4. --   - "auto": Choose automatically so that the hero is not hidden.
  5. --   - "top": Top of the screen.
  6. --   - "bottom" (default): Bottom of the screen.
  7. --   - a table with x and y integer fields.
  8.  

7
Development / Re: Store map entities in a table automatically
« on: August 01, 2018, 03:12:23 pm »
Thanks ^^
Then you have a table of destination names and not a table of destinations.

8
Development / Re: Store map entities in a table automatically
« on: July 31, 2018, 10:18:06 am »
map:get_entities_by_type() is made for you.
Code: Lua
  1. local destinations = {}
  2. for destination in map:get_entities_by_type("destination") do
  3.   destinations[#destinations + 1] = destination
  4. end
  5.  

9
Development / Re: Custom entity and associate sprite : strange offset
« on: July 29, 2018, 05:13:45 pm »
For historical reasons, doors and NPCs have different origins. The origin of doors is (0,0) and the origin of NPCs is (8,13). I had a tendency to choose (8,13) for entities that are standing, like the hero, enemies, NPCs, and to keep (0,0) for flat entities like doors or tiles. This was because the origin point is supposed to represent the point where the entity touches the soil. Like the center of the feet of a character. That did not make sense for doors and tiles.
Anyway, this historical choice no longer makes a lot of sense for entities like custom entities for example, since the engine cannot guess what they are supposed to represent.

Good news: in Solarus 1.6, you can change the origin and even the size of all entities from your scripts :)

10
Development / Re: Custom entity and associate sprite : strange offset
« on: July 29, 2018, 02:17:56 pm »
I won't change the behavior because of it would break existing scripts.
Maybe it was not the best choice but at least it is now documented: http://www.solarus-games.org/doc/1.6/lua_api_custom_entity.html#lua_api_custom_entity_set_origin

You can easily fix the problem by calling entity:set_position() after entity:set_origin().

11
Bugs & Feature requests / Re: [Solved]door function issue?
« on: July 26, 2018, 08:47:47 pm »
Indeed, a delay of 0 means to loop forever.

12
Development / Re: Required Sound Effects?
« on: July 26, 2018, 08:19:44 pm »
There are still some hardcoded sound names in the engine, but no "monkey" or "octorok". Maybe these sounds are declared in your quest tree but missing on the filesystem? You can use the quest editor to show these kind of inconsistencies in the quest tree.
The engine attempts to preload all sounds declared in your quest if you call sol.audio.preload_sounds(). That would explain your problem.

The full list of files whose name is still hardcoded in the engine is detailed here: https://gitlab.com/solarus-games/solarus/blob/dev/work/data_files.txt (and we try to reduce it with every release).

Last remark: I recommend to use the latest release (1.5.3) rather than 1.5.1 to have a more stable engine.

13
Bugs & Feature requests / Re: door function issue?
« on: July 26, 2018, 08:16:04 pm »
Does the animation "opening" of your door sprite correctly ends? Because if it loops, that might explain that the opening state never finishes.

14
General discussion / Re: Free Pixel Art Making Programs
« on: July 19, 2018, 09:42:29 am »
Aseprite is great, the Solarus team uses it (Neovyse and Diarandor). All new graphics of Zelda XD2 were done with Aseprite by Neovyse.

15
Development / Re: Enemies slowing down as they take damage?
« on: July 18, 2018, 09:42:34 pm »
Your timer has no explicit context:
Code: Lua
  1. sol.timer.start(100, function() enemy:check_hero() end)
  2.  
So by default, it belongs to the map. Which means that every time the enemy is hurt, the timer is *not* canceled (as it would be if the context was the enemy), so after the enemy restarts a new timer is created and the previous ones are still active. So check_hero is called more and more often, and apparently that stops and restarts a movement all the time.

Use the enemy as context:
Code: Lua
  1. sol.timer.start(enemy, 100, function() enemy:check_hero() end)
  2.  

Unrelated remark: you can return true in the timer callback to repeat it automatically instead of creating a new timer. This will simplify the code. (I guess you used an old ZSDX enemy script that was written before this feature (< Solarus 1.2) :)).

Pages: [1] 2 3 ... 75