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 - froggy77

Pages: 1 ... 8 9 [10]
Development / Help: reactivate a switch without reloading the map
« on: December 07, 2014, 01:15:05 pm »

I don't understand how to activate/reactivate a simple switch without reloading the map.
I works for crystal blocks, I would like the same behavior for a "light switch" to turn on / turn off the light and I would select my own sprites.

It's the same problem for the switch in the "test map" called Outside B2 (Village) of the tutorial. If I want to disappear again the ladder of the map, how should I do?
Once enabled, the switch (crystal) remains in yellow and can not be hit with the sword.

Code: [Select]
local map = ...
local game = map:get_game()

function light_switch:on_activated()

function light_switch:on_inactivated()


Thank you for answering. For now, it does not work. :(
I kept the sprite "sprites/enemies/enemy_killed.png", but added several animations to it (Just a change of colors to test).
I simply copied / pasted the lines from enemy_killed.dat and put y = 32.
So I get two animations in enemy_killed.dat ("killed" and "test")

In   function enemy:on_dying(),   I added
Code: [Select]
sprite:set_animation("test")This tries to work with the enemy sprite and not "enemy_killed.png"
So I put this instead.
Code: [Select]
local sprite2 = enemy:get_sprite()
This tries to work too with the enemy sprite.and not "enemy_killed.png"

OK, so I tried another thing, I copied my new lines from enemy_killed.dat to paste them into .dat of the enemy.
It's not OK, because the enemy sprite is replaced too soon and then there is the usual animation called "killed".
Moreover, the animation is either too fast (I played with the "frame_delay") or incomplete  because the sprite is killed.

I even deleted the pixels to make transparent the "killed" animation.
I tried with  a create_sprite, but Solarus crashes and I have nothing in error log.
Code: [Select]
local sprite2 = enemy:create_sprite("enemies/enemy_killed")
What I know is that the problem exists between keyboard and chair. ;D


I wonder if it is possible to call a sprite, during the "enemy:on_dying()", other than this sprite "enemies/enemy_killed" , for example, for a specific type of enemy.
"enemies/enemy_killed" would be the default sprite when nothing specified.

If so, what is the way to get it?

Thank you in advance.

Pages: 1 ... 8 9 [10]