Football kick

BlitzPlus Forums/BlitzPlus Programming/Football kick

Thunder Blitz(Posted 2015) [#1]
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


_PJ_(Posted 2015) [#2]
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) )


Rick Nasher(Posted 2015) [#3]
Or use Blitz3d with a physics engine such as PhysX that does all the calculations for you.


okee(Posted 2015) [#4]
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/


H&K(Posted 2015) [#5]
Its not pong, the ball will mostly go in the direction the player wants it to. Decide how that is going to work first.


RemiD(Posted 2015) [#6]
learn about vectors