# How do I create wind blowing an object

Get help using Construct 2

### » Tue Apr 08, 2014 3:56 pm

First of all, I want to make a random wind in x seconds that will blow the Player and make it swing for y seconds.
Means, every x seconds, wind will blow for y seconds. Anyone can teach me how to write the event or any other things I need to know?
B
5
S
1
Posts: 35
Reputation: 481

### » Tue Apr 08, 2014 11:32 pm

Have you looked into the Physics object yet ?
Using R248 for all examples
B
70
S
21
G
6
Posts: 382
Reputation: 9,812

### » Wed Apr 09, 2014 3:40 am

@emoaeden I'm trying to put Every x seconds, Player->Apply Force Y-> (duration), how do I make the wind apply force towards the player for y seconds?
B
5
S
1
Posts: 35
Reputation: 481

### » Wed Apr 09, 2014 3:45 am

You could try making a variable for your *y* seconds and remove 1 every second and set it to 0 when it goes below 0 then all you would need to do is set it to the ammount of seconds you want it to last when the conditions are right.
B
48
S
9
G
5
Posts: 281
Reputation: 5,818

### » Wed Apr 09, 2014 5:59 am

Sorry erm could you pls clarify it?
B
5
S
1
Posts: 35
Reputation: 481

### » Wed Apr 09, 2014 5:33 pm

Ok here's an example I hope its better explained this way.
Basically I made a global variable "WindTimer" and set it to 0 as my default.
in
System every 1.0 seconds I'm removing 1 from WindTimer
Also I set my timer thisway to prevent negatives
System WindTimer (les than or equal) 0 | Set WindTimer to 0
---

So lets say every 5 seconds I set my WindTimer to 8 (so that you will be recieving wind for 8 seconds
if my WindTimer is greater than 0 | apply force 200 at angle 180 at image point 0

I hope it answers your question. The Capx should be a bit clearer since you can see it in action.

 as a side note it probably would be wiser to change the 5 for a 10 and the 8 for a five so you don't have overlapping "perpetual" wind like in my capx
Good luck
You do not have the required permissions to view the files attached to this post.
B
48
S
9
G
5
Posts: 281
Reputation: 5,818

### » Wed Apr 09, 2014 6:52 pm

I like how the user with the answer is @Ragevortex! Seems very fitting. Also, I like this concept of something blowing against the player/object.
B
7
S
1
G
1
Posts: 56
Reputation: 732

### » Wed Apr 09, 2014 7:30 pm

@punkineo heh funny... I see what you did there with the name and the wind

I remember back in the megaman days one of the stages (wind guy who I cannot remember the name of stage) there was a gust of wind that blew the player backwards at certain time intervals. If you were caught jumping at a bad time you got swooped into the emptiness below. I'm not sure if that's what Serge Low wants to do but I still hope it helps.
B
48
S
9
G
5
Posts: 281
Reputation: 5,818

### » Thu Apr 10, 2014 3:15 am

@ragevortex thanks for answering my question! It's very kind of you to explain so detail to me, thanks again.
B
5
S
1
Posts: 35
Reputation: 481

### » Thu Apr 10, 2014 3:20 am

And I also want to ask another question, how to reset the time to 0 everytime i restart my layout? Means that some event like Time>5s | an action will be done, but sometimes when time is passed 2s and i restart my layout, so the next action will be 3s later happen, so how to reset the time to 0 everytime i restart?
B
5
S
1
Posts: 35
Reputation: 481

Next