Pesky ol' gravity... always ruining my plans...

Blitz3D Forums/Blitz3D Beginners Area/Pesky ol' gravity... always ruining my plans...

Buggy(Posted 2006) [#1]
Hey again! I'm trying to insert gravity into a sphere movement test (which is also failing miserably, by the way), and when I say:
player\yinertia# = player\yinertia# - gravity#

the sphere starts floating upwards. But if instead, I say:
player\yinertia# = player\yinertia# + gravity#

the sphere shoots upwards extremely quickly. I want it to stay down, not go up! Help!

In addition, I have other problems...

The line: "If EntityCollided(player\sphere, 1) > 0" doesn't seem to work.

Also, the following jump function doesn't work.

If player\jumping = 1
	
			player\yinertia# = player\yinertia# + player\jump#
		
			player\jump# = player\jump# - .01
		
		If player\yinertia# = 0
		
			player\jumping = 0
			
		EndIf
		
	EndIf


After the ball touches the ground from jumping, it starts floating upwards, and I think this might have to do with the first problem.

Help me... I'm a mess!


Myrmydon(Posted 2006) [#2]
You don't have to do wxactly on the first problem you can juist have the shpere canstatnly moving down and by using the TranslateEntity set the y (2nd in xx,yy,zz for newcomers) it around -20 (note you can stilll move the sphere upward after this but at the second problem why not translate ther entity up fo about say 15 (easier way)


Stevie G(Posted 2006) [#3]
Buggy,

Here's a simple example using accumulated acceleration forces which should help you.

Press space to jump.

Stevie