Sprite sleep

Get help using Construct 2

Post » Tue Aug 23, 2016 10:11 am

Hi guys,

I start create a platform game, i want know how can i set animation "sleep" before 5 seconds of player stopped use command.

any can help me?
B
10
Posts: 53
Reputation: 460

Post » Tue Aug 23, 2016 11:05 am

Hello,
You use Touch, Mouse, or keybord ?
However, use variable (named "Sleep" ?), then create function named "Start sleep timer".
On "Start sleep timer" function -> Set Sleep to 0.
Repeat 5 times -> Wait 1 second then add 1 to sleep.

Condition : Sleep = 5 & Trigger Once -> Start your sleep.

On touch, or clicked, ect -- > Call function "Start sleep timer".
Last edited by Saad Swad on Tue Aug 23, 2016 1:09 pm, edited 1 time in total.
B
17
S
10
G
19
Posts: 140
Reputation: 11,457

Post » Tue Aug 23, 2016 12:02 pm

Touch,
Is first time i use function, so double click to layer - add function - Add aautomatic and rename to Start Sleep timer .. OK

Repeat 5 times -> Wait 1 second then add 1 to sleep. <-- help :D? add another codition to first or whatelse ?
B
10
Posts: 53
Reputation: 460

Post » Tue Aug 23, 2016 1:11 pm

B
17
S
10
G
19
Posts: 140
Reputation: 11,457

Post » Tue Aug 23, 2016 1:32 pm

In your character create a new Number Variable called Sleep TImer. Have it's default value at 0.

Image

Since your game is a touch game, I assume you have sprites that you have to hold to make your character move. You'll want to create a "If Touching Object "the area(s) you touch to move your character" and invert it, then create a sub-event of "Every 1 seconds, add 1 Character.SleepTimer". Then you'll need a "If SleepTimer = 5, set 'Sleep' animation" and a "If SleepTimer <5, set 'Idle' animation". You'll also need a "Is in Touch" with a sub-event "Every tick, set SleepTimer to 0".

Image

Bare in mind, I've never worked with Touch before so it may be wrong; but it seems like the general idea to follow.
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560

Post » Tue Aug 23, 2016 2:41 pm

@sad @temple realy thanks all 2
B
10
Posts: 53
Reputation: 460


Return to How do I....?

Who is online

Users browsing this forum: divsyntax, volumetv and 17 guests

cron