Menu

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.

Show posts Menu

Messages - BlisterB

#1
Bugs & Feature requests / Re: Complex movements
June 24, 2018, 08:44:02 PM
Wow thank you for the extra quick answers  ;D !

Christopho, that seems to perfectly fit, thank you ! Diarandor I'll watch your videos on the train :).
#2
Bugs & Feature requests / Re: Complex movements
June 24, 2018, 07:56:18 PM
For example, I want that a character named Sheik does this pattern at the map's loading :
- few steps upward
- face left
- wait few time
- few steps downward

Here is the quicker way to code that I found :

function sheik_intro_movement()
  local step = 0
  local movement = sol.movement.create("path")
  movement:set_speed(64)
  movement:start(sheik)
  function movement:on_finished()
    if step == 0 then
      movement:set_path{2,2,2,2,2,2}
      movement:start(sheik)
      step = step + 1
    elseif step == 1 then
      sheik:get_sprite():set_direction(2)
      sol.timer.start(200, function()
        step = step + 1
        movement:on_finished()
      end)
    elseif step == 2 then
      movement = sol.movement.create("path")
      movement:set_speed(64)
      movement:set_path{6,6,6,6,6,6}
      movement:start(sheik)
      step = step + 1
    end
  end
end


Please note that in step 2 I'm realocating the movement variable movement = sol.movement.create("path") because if I just do movement:set_path{2,2,2,2,2,2}, the character is teleported at the destination for some reason.
#3
Bugs & Feature requests / Complex movements
June 24, 2018, 07:12:08 PM
Hello  :)

I'm starting with Solarus engine and I was wondering : is it possible to create complex movements including changement of directions and pause?
Something like :
movement.add(straight_movement(east))
movement.add(wait(5))
movement.add(facing(east))
movement.add(jumping(right))

For the moment, I don't understand how to include a pause in a movement, and the only way I find to change a direction after a movement is to create a lot of movement:on_finished() which is pretty redundant.
Sorry if the solution already exist, I didn't manage to find it in the documentation :S.