Angle, Power, and Wind Variation?

0 favourites
  • 8 posts
From the Asset Store
Weather Wind Sounds - Wind contains 10 tracks (1 tracks and 9 seamless loops)
  • A few years back I posted about how could I make a Scorched Earth type game. I revisited that thread and noticed I can't open the .cap file anymore, so I figured I would ask again, since C2 has been updated in a huge way since then.

    Basically I am trying to make a artillery game that uses angle and power. How would I use the mouse for aiming (using a trigger cursor), using the left mouse button for power (mouse button held down) + shows a power bar, and random wind variation that effects the projectile. The hardest part for me would be the calculations that include gravity, force, etc..

    This is the same concept as Scorched Earth, minus the destructible terrain. I would greatly appreciate any help, as this would spark the interest in this game I've had for years now.

    Thank You

    InsertCoin25

  • Here I made a very basic example, maybe it will help you.

    https://copy.com/W63KH3yzZu0C

  • Thanks Imchucho this is going to help immensely. Just have one other question before I begin. Is the wind speed and variation always facing the players direction? If so, how would I make it change directions? For example show an arrow in what direction the wind is blowing. Thank you again Imchuncho <img src="smileys/smiley1.gif" border="0" align="middle" />. I greatly appreciate this.

    InsertCoin25

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Imchucho used the bullet behavior, witch also has a gravity property. The wind is only a subtraction from the power of the bullet so it's always facing the player in this implementation.

    If you use the physic object, you can apply a force to your object. In your case, the wind is just a constant force (or maybe you want it to vary too) to apply to your projectile. Only thing to change from what Imchucho did then would be to set a starting speed instead, and the gravity/force for the wind will do the trick.

  • Here its the example updated

    https://copy.com/lPxgSVUjsU3Q

    The wind now can blow left or right, and the bullet is affected properly.

    if you want it to blow in 360 directions you only need to make the wind affect the gravity of the bullet the same way it is affecting the power.

    <img src="smileys/smiley1.gif" border="0" align="middle">

    You can also try with physics, like Guizmus propossed. Look at a couple tutorials and once you know how to use the physics beahvior you will be able to make a much nicer simulation.

  • Thank you both, lmchucho and Guizmus. This is very much appreciated. So what I am gathering from the recent posts is that physics would probably be the preferred method in this type of game? Can I still use the same code or events that Imchucho created? I would just have to change the physics behaviors, correct? Thanks again <img src="smileys/smiley1.gif" border="0" align="middle" />

    InsertCoin25

  • If you use physics the events wont be the same. Physics is better because its a behavior dedicated to what you want to do in the game, simulate the bullet physics, but if you arent familiar with it and you dont have the time to read tutorials, just keep the example I made for you and try to improve it.

  • Ah...understood. I do plan on learning about physics in the future, but I am going to wait until I understand the basics a little more. Starting with the example you made for me. Then working my way forward apply what I need for my game. It's an interesting program and fun to work with. Thanks again for the help and when I get a half way decent game working I will post the results here for you to look at.

    Take Care

    InsertCoin25

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)