Shield power up help?

Discussion and feedback on Construct 2

Post » Mon Feb 24, 2014 4:37 am

Hello, i am very new to construct 2 and i am trying to do a shield when the player collides into the shield.
for 10 seconds it lasts not taking damage while once its over it reverts back to normal.
i really have no idea how to do this, i hope someone can help me achieve this thanks.
B
4
S
1
Posts: 8
Reputation: 343

Post » Mon Feb 24, 2014 8:55 am

Hi,

You have multiple ways to do this, here is one :

1) Add a Timer behavior on your character (https://www.scirra.com/manual/167/timer)
2) Add a Boolean variable on your character named for example canTakeDamages and set it to true by default.
3) On your character damages logic (the conditions / events where he takes damages) add the boolean condition, so by default he can take damages.
4) On collision with the power up, set the boolean to false, and start a time "onShieldOff".
5) Create a new condition "On timer" with the tag "onShieldOff", and add an action for the character where you set back the boolean to his original value.

Maybe I missed something but you have the idea !

(You should post this to the "How do I... ?" forum :)
B
40
S
15
G
5
Posts: 295
Reputation: 6,129

Post » Mon Feb 24, 2014 1:06 pm

Thanks for the help, mate.
I am really trying to learn things since, I new to construct 2. Would you mind sharing a little example how would you execute it, I hope is no bother, thanks. Either way thanks once again mate.
B
4
S
1
Posts: 8
Reputation: 343

Post » Mon Feb 24, 2014 1:42 pm

You should try by yourself or you ll never get C2 logic. At least try something and if it doesn't work post the capx here. :)
B
40
S
15
G
5
Posts: 295
Reputation: 6,129

Post » Mon Feb 24, 2014 8:39 pm

so this is what i got, it doesn't seem to work unless i did something wrong..
everything seems alright

dropbox.com/s/3c6bv6u5knpg86r/powerup-example.capx
B
4
S
1
Posts: 8
Reputation: 343

Post » Mon Feb 24, 2014 9:34 pm

B
40
S
15
G
5
Posts: 295
Reputation: 6,129

Post » Mon Feb 24, 2014 9:58 pm

Deadartcore can only post plain text URLS when they have 300 rep. 1 URLS removed. Why?

Joskin wrote:Try this !



:)


thanks, mate i appreciated it great help. :D one last thing i added a set animation to "shield" when player collides to shield turns him yellow but how do i remove the animation to original aspect to blue after the 10 seconds.

sorry for asking so much.
B
4
S
1
Posts: 8
Reputation: 343

Post » Tue Feb 25, 2014 8:44 am

You changed the player animation frame ? Or the shield is rotating around the player ?

If it's the frame when the timer is over set it back to the original frame and if you are rotating the shield around the player you can simply destroy the shield.
B
40
S
15
G
5
Posts: 295
Reputation: 6,129

Post » Tue Feb 25, 2014 1:41 pm

Joskin wrote:You changed the player animation frame ? Or the shield is rotating around the player ?

If it's the frame when the timer is over set it back to the original frame and if you are rotating the shield around the player you can simply destroy the shield.


Thanks for the help, just made it work i just set animation to "shield" when on collision and when timer is gone set animation to "default" now it works flawless. thanks mate.
B
4
S
1
Posts: 8
Reputation: 343


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests