How do I make something only change a variable when it's...

0 favourites
  • 6 posts
From the Asset Store
It's here!
$4.95 USD
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

    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..

  • 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..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)