What I try to achieve is for a solid object, to be able to “jump over” (passing through) a solid obstacle when a button is pressed. This without using physics and without passing through other solids.
I have attached a simple .capx as an example.
As the game world is filled with solids (jumpable obstacles, not jumpable obstacles and enemies that keep following the player), the player should be able to only “jump” over the obstacles but not being able to jump over (passing through, other solid.
In the .capx, attached, I try to explain the scenario that is composed by:
-a enemy that follows the player
-And a box
The player and the enemy cannot pass through any other solids. But by pressing a button, the player should be able to jump over the obstacles, but not over the box.
At the same time, the enemy will still not b able to jump over the obstacles.
Any contribution would much appreciate!
Develop games in your browser. Powerful, performant & highly capable.
Not yet had time to check the capx sorry, but one solution would probably be to switch to an animation "jump" and during that animation disable the behaviors on the player (solid and movement), and then force the player to move forward until the animation ends. Do a check before triggering the jump to make sure the player is facing towards an obstacle and is allowed to jump over it (eg: overlapping a sprite made invisible called AllowJump).
I made an example...
The problem is, I'm tweaking the fences solid behavior, so, when the player jumps, the enemies can cross the fences too. I'll try to work around this issue, but, for now, you can check this version!