Football kick
BlitzPlus Forums/BlitzPlus Programming/Football kick
| ||
Hi. I'm trying to make an one on one football game . My problem now is : when a player kicks and hits the ball, how can i give the ball a direction depending on the kick ? Thanks |
| ||
Essentially this would most likely involve some form of trignometrical calculation between the player and the ball, or some tracking to record the player's last direction moved. The direction in degrees can be obtained by: ACos ( (BallY-PlayerY) / (BallX-PlayerX) ) |
| ||
Or use Blitz3d with a physics engine such as PhysX that does all the calculations for you. |
| ||
Might be worth checking out Matt Sephtons Simple Soccer http://sourceforge.net/projects/simplesoccer/?source=typ_redirect Was written in Blitzplus and has some sample code Also there's Yoda Soccer, older versions were coded in blitzbasic but newer versions are blitzmax Looking at the link it looks like version 0.70 was the last version in blitzbasic as the newer versions have mac and linux downloads http://sourceforge.net/projects/yodasoccer/files/yodasoccer/ |
| ||
Its not pong, the ball will mostly go in the direction the player wants it to. Decide how that is going to work first. |
| ||
learn about vectors |