How do I make an object (e.g the player) only change a variable on another object (e.g health) when the first object is on a specific animation? To be more precise, I'm making a platformer and I want my player to only be able to hurt the enemies when they've got a sword in their hand, and only if they press the spacebar when they're next to the enemy. HELP.
You mean something like this?
On space bar pressed
pick enemy where distance(player.x,player.y,enemy.x,enemy.y) < 100
enemy is playing animation "sword"
enemy subtract from health 50
Develop games in your browser. Powerful, performant & highly capable.
You mean something like this? On space bar pressed pick enemy where distance(player.x,player.y,enemy.x,enemy.y) < 100 enemy is playing animation "sword" > enemy subtract from health 50
> enemy subtract from health 50
I may seem like a noob, but how can I get the Keyboard object? Is it avaliable on the free version? I think I need it to get "When spacebar is pressed".
Right click your layout - choose insert new object - choose keyboard..
It isn't there and I haven't used it on any of the layouts.
It should either be in the add object dialog or already present in your project..