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

Get help using Construct 2

Post » Sat Sep 19, 2015 4:32 pm

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.
B
3
Posts: 6
Reputation: 189

Post » Sat Sep 19, 2015 4:50 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Sep 19, 2015 5:26 pm

LittleStain wrote: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".
B
3
Posts: 6
Reputation: 189

Post » Sat Sep 19, 2015 5:45 pm

Right click your layout - choose insert new object - choose keyboard..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Sep 19, 2015 8:00 pm

LittleStain wrote: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.
B
3
Posts: 6
Reputation: 189

Post » Sun Sep 20, 2015 8:39 am

It should either be in the add object dialog or already present in your project..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Microbex, PROxMTswatTR and 17 guests