Open Diarandor opened 8 years ago
This sounds over-engineered. Wouldn't this be better dealt with by using collision boxes?
@alexander-b: Nope, this feature is really important for secondary sprites (or "decoration" sprites), and should be added to the engine, IMHO. For instance, if an enemy has wings, or a custom shadow (which allows more control than the built-in one), or other sprites that should not collision with the hero. How would you code that? Collision boxes are not a solution, this problem is about pixel-precise collisions of particular enemy sprites. (Edit: well, I don't actually understand what you mean by collision boxes that could be used here.)
Until now I have been using custom entities that follow the enemy position with a timer. But that is a lot of code and pretty annoying to do (it's much more work and has to be done again and again each time we need to use this feature, which has happened to me a lot of times, and we have to add extra code to certain events to be sure that the custom entity with the sprite is removed when the enemy is killed or removed, etc).
On the other hand, since we already can choose if a sprite is invincible or not, why not allowing to choose if a sprite can hurt the hero or not?
@christopho: Do you think this can be done for Solarus v1.6???
Ok!
This issue is not necessary anymore, since the problem can be solved in a different way as I did in: https://github.com/solarus-games/children-of-solarus/issues/67
You can close the issue or keep it open if you want to code it someday.
Since an enemy may have several sprites, it would be nice to allow choosing if a given sprite can attack the hero or not. The syntax could be:
enemy:set_sprite_can_attack(sprite, [can_attack])
(This could be used, for instance, for the wing sprites of a flying enemy.)