# How do I create wind blowing an object

0 Favourites
• 13 posts
• 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?

• Have you looked into the Physics object yet ?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• 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?

• 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.

• Sorry erm could you pls clarify it?

• 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

• 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.

• 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.

• Ragevortex thanks for answering my question! It's very kind of you to explain so detail to me, thanks again.

• 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?

• It is my understanding that everything or mostly everything gets reset when you restart layouts however for cases (like in the game I'm making) in which i want to have absolute certainty and control I usually have something like this setup:

Global variables:

MyTimer = 0 (original value of the variable)

Events:

On start layout | set MyTimer = 0

...

This way I make sure that it's always 0 when I restart that layout.

Remember if you have a text field or something displaying your time value you have to check that is correct too.

I hope this helps you a bit its not much different than what i posted in the capx originally.

• Their is a option to reset global variables when your layout restarts in the system section of the events. It is under add action, Global & local variables, reset global variables

• Ok thanks guys! ^^