How to disable controls after death?

Get help using Construct 2

Post » Tue Feb 05, 2013 3:59 pm

I have an animated player sprite that moves into a different animation when it dies. I am using the W key as a forward movement and angle is locked to the mouse. The problem I am having is when the player sprite dies if I am moving when the death happens the sprite immediately resets to the movement animation assigned to the W is down action. I need it so that when the player sprite dies it no longer sees the W is down action until after the death animation and the player sprite is created again.

Any help would be appreciated.
B
7
Posts: 14
Reputation: 481

Post » Tue Feb 05, 2013 4:02 pm

Also how do I get it to stop recognizing the left mouse button press for firing....it looks lame that the dead dragon can still fire fireballs.....lol
B
7
Posts: 14
Reputation: 481

Post » Tue Feb 05, 2013 4:16 pm

http://www.scirra.com/tutorials/37/beginners-guide-to-construct-2/page-6

Use instance variables like this to dictate phases of your character.
For example if character phase variable =1 movement is allowed, set at default numbers
The character "dies" set the variable to 2. While the variable is 2 this could decrease character speed to 0 etc.

B
15
S
5
G
2
Posts: 154
Reputation: 3,076

Post » Tue Feb 05, 2013 4:17 pm

You can use Groups for that.

put all of your player controls to a group ie. "player" (activate)

and the when player dies set group "player" to deactivate.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Tue Feb 05, 2013 6:30 pm

Thank you for your reply. I'm sorry i'm a noob at this. I created the group Player and placed all of the movement events in there. Now how do I deactivate the group within the death and destroy scenario?
B
7
Posts: 14
Reputation: 481

Post » Tue Feb 05, 2013 6:46 pm

In events under System you have an option to set group active, deactivate the group from there.

Post a capx, it's easier for poeple to grasp what you are trying to do and you will get the answers you're looking for quicker.
B
14
S
3
G
5
Posts: 41
Reputation: 3,490

Post » Tue Feb 05, 2013 6:59 pm

http://lewispcservice.com/downloads/dragonrage.capx
B
7
Posts: 14
Reputation: 481

Post » Tue Feb 05, 2013 7:04 pm

You will see that when one of the enemies (jittery flying rocks) hits the player the player goes into a death animation. If you are moving when the player gets hit by the enemy you don't see the death animation because it registers the pressing of the W key and plays the moving animation. The death animation works fine if you sit still and wait for an enemy to hit you. The other issue is when you are lying dead on the ground you can still shoot. But I assume both issues can be fixed with the same process.
B
7
Posts: 14
Reputation: 481

Post » Tue Feb 05, 2013 7:14 pm

https://dl.dropbox.com/u/14087254/dragonrage.capx

an important lesson for every body. Groups and Functions are your best friends.. I hope you have 117.

You capx was a super easy fix :)
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Tue Feb 05, 2013 7:15 pm

ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Next

Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 27 guests