This site requires JavaScript, please enable it in your browser!
Greenfoot back
sgt12
sgt12 wrote ...

2013/12/4

Shooting parabola

sgt12 sgt12

2013/12/4

#
Hi, How to make a shooting parabola like angry bird?
Zamoht Zamoht

2013/12/4

#
You have a few options but here is one of them. http://i.imgur.com/vYTMnBZ.png This is the parabola function you will need. g is gravity (9.8m/s^2 in the real world), v0x is the "horizontal start power" (m/s), v0y is the "vertical start power"(m/s) and y0 is the vertical start position (m). Remember that you are not calculating with meters and seconds but with pixels and acts. Here is an image that explains the function. http://i.imgur.com/Jbs3n57.png This is from a danish book so "slut" means end. When you have the function you have some options for implementing it in your program. One way is to add one to an x variable every act and then calculate a y variable using the function. After that you can use your x and y values to change the location of your actor. NOTE: The coordinate system in Greenfoot has reversed y values. You can fix this with getWorld().getHeight()-y where y is the value calculated using the function.
Zamoht Zamoht

2013/12/4

#
You can also take a look at my Parabola scenario . This creates a parabola using 3 points. Please tell me if none of these solutions fit your needs.
danpost danpost

2013/12/4

#
My Flight Trajectories Demo demonstrates two ways to accomplish the parabolic motion of flight trajectories. I am sure one of them will suit your needs.
You need to login to post a reply.