Gravity

BlitzPlus Forums/BlitzPlus Beginners Area/Gravity

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Without really testing, my estimation is that your stone needs an angle and a decaying speed (in the end, pixelwise, this will be converted to a deltaX and deltaY using sine and cosine) while gravity pulls the stone done, this gravity is then just added or subtracted from the stone's Y coord.

so:

start:
* convert stone angle+speed to deltaX and deltaY (float values!)
* add or sub a gravity amount
* draw stone
* multiply the stone speed with 0.999 or something
loop

Don't have this angle+speed converting formula at hand, it's not difficult tho, but it's probably
deltax=sin(angle)*speed
deltay=cos(angle)*speed

ohwell it probably *is* the fomula anyway.. :P


Perhaps another method is tho change the angle instead of just the y-coord.