Stop commands for a period of time?

Get help using Construct 2

Post » Tue Jan 10, 2012 8:40 pm

I'm trying to figure out if there is a way to "freeze" the character (but not his animation) for exemple for 1 or more (or less) seconds

for exemple

if the character is hitten by something it will stop working for 0.3 seconds

there is a way do make this kind of function?
B
5
G
1
Posts: 32
Reputation: 939

Post » Tue Jan 10, 2012 8:41 pm

you mean freezing like not reacting to the userinput?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Jan 10, 2012 8:43 pm

not reacting to the user imput is something like "ignoring user imput"
but the problem is to make it last some seconds, no matter the input of the user
B
5
G
1
Posts: 32
Reputation: 939

Post » Tue Jan 10, 2012 8:46 pm

one way, that pops in my mind is to create a timer, that fires every 0.1 seconds and increases a global variable.
Then at the moment of the freez, you store this global into a local and have another event check, if the local + 0.3 is reached by the global...then you can un-freezeWeishaupt2012-01-10 20:46:33
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Jan 10, 2012 9:27 pm

it would work even to create a timer that check if the desired value is reached every 0.1 seconds, and if not it will increase the value and retry maybe?

maybe something like:

System: Every 1.0 seconds (1.0 because it's more visible)
   Sprite: timer < 3
   --> Sprite: add 1 to timer
   Sprite: timer = 3
   --> Sprite: stop ignoring platform user input   
   --> Sprite: set timer to 0
B
5
G
1
Posts: 32
Reputation: 939

Post » Tue Jan 10, 2012 9:37 pm

sure....I just think its a good idea to create an "overall" usable timer. Just be warned, an increase of 0.1 seconds, ie. increasing the variable 0.1 can go by undedected - just happend here - so you should check a range like 3.0 to 3.5 seconds....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Jan 11, 2012 12:24 am

Somehow I've managed the problem (for now >,<)
Thanks for the help ;)
B
5
G
1
Posts: 32
Reputation: 939

Post » Wed Jan 11, 2012 10:18 am

I think a much easier way might be to use the system 'Wait' action!

+ On some event
-> Set ignoring input
-> Wait 1 second
-> Set not ignoring input
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jan 11, 2012 11:23 am

[QUOTE=Ashley] I think a much easier way might be to use the system 'Wait' action!

+ On some event
-> Set ignoring input
-> Wait 1 second
-> Set not ignoring input[/QUOTE]

Honestly Ashley - IMHO there are only a few people out there that really understand how WAIT works. I think I have a slight idea how it works and its designed and still I stumble over unpredictable behaviour, so I try to establish almost everything avoiding WAIT!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Jan 11, 2012 12:29 pm

[QUOTE=Ashley] I think a much easier way might be to use the system 'Wait' action!

+ On some event
-> Set ignoring input
-> Wait 1 second
-> Set not ignoring input[/QUOTE]


It's good and it actually seem to work well for my purpose ;)
and since I can't see any sort of bug for now and I've ended the event limit for the free version of the program, this is way shorter and suitable than the other ;P

Thank You!!

[I don't know what kind of issue the wait function may generate btw but I couldn't see any problem untill now]
B
5
G
1
Posts: 32
Reputation: 939

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, SpartCrafter, Yahoo [Bot] and 25 guests