solarus-games / children-of-solarus

This repository was moved to GitLab: https://gitlab.com/solarus-games/children-of-solarus
http://www.solarus-games.org
Other
38 stars 8 forks source link

Add functions for sword collisions while jumping #70

Open Diarandor opened 6 years ago

Diarandor commented 6 years ago

Add functions for the use of the sword while jumping, and detect collisions only when necessary. (Note that the sword can already be used while jumping, with the custom jump script.)

We could do something like in the Oracle games (dungeon 4 in OOA): some types of fire-bats can fly at different heights. At the hightest height they are invincible and cannot hurt the hero, at a middle height they can only be hurt by the sword or hurt the hero if the hero is jumping, and at a lower height they can hurt or be hurt by the sword if the hero is not jumping. Also, note that the cuttable plants cannot be cut by the sword if the hero is jumping; I have not checked this yet for enemies on the ground, but it may be the same.

We need some functions in the collision tests or events to make all of this possible. (I am not sure yet, but there may be some limitations in the current version of the engine not allowing to do all of this easily.) These functions have to be added to the metatables or scripts of enemies, hero, and the custom jump script.