Angle, Power, and Wind Variation?

Get help using Construct 2

Post » Tue Jan 28, 2014 1:00 am

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 InsertCoin252014-01-29 23:00:43
B
4
G
1
Posts: 17
Reputation: 530

Post » Tue Jan 28, 2014 3:33 am

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

https://copy.com/W63KH3yzZu0C
B
10
S
4
Posts: 133
Reputation: 1,543

Post » Tue Jan 28, 2014 3:32 pm

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 . I greatly appreciate this.

InsertCoin25InsertCoin252014-01-28 15:32:32
B
4
G
1
Posts: 17
Reputation: 530

Post » Tue Jan 28, 2014 3:39 pm

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.
B
17
S
8
G
4
Posts: 473
Reputation: 6,191

Post » Wed Jan 29, 2014 3:25 am

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.



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.
B
10
S
4
Posts: 133
Reputation: 1,543

Post » Wed Jan 29, 2014 8:23 pm

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

InsertCoin25InsertCoin252014-01-29 22:59:49
B
4
G
1
Posts: 17
Reputation: 530

Post » Thu Jan 30, 2014 2:53 am

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.
B
10
S
4
Posts: 133
Reputation: 1,543

Post » Thu Jan 30, 2014 11:36 pm

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
B
4
G
1
Posts: 17
Reputation: 530


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 42 guests