I am making a stealball game where you have to hit the ball and get it away from your oponent.I just need help with the balls physics.I need so that the harder you hit the ball the faster it goes,But i also want the ball to slow down.Im not great with this kind of math so i just made up a script.
http://scratch.mit.edu/projects/keroro645/290423
Offline
To determine the power of the shot find how fast the cursor is moving.
like this
forever
Set power to 0
change power by ABS( oldX-x position)
change power by ABS( oldY-y position)
set power to (power*0.1) //You may want to lower this variable or it will make the ball go crazy
set oldX to xposition
set oldY to yposition
end
When the ball is hit do this
when touching (paddle)
change velocity by power
To lower velocity do this
forever
set velocity to (velocity*0.95)
Offline