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]
136
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()
sprite2:set_animation("test")
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

137
Hi,

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]