Help

Blitz3D Forums/Blitz3D Beginners Area/Help

AJ00200(Posted 2009) [#1]
Why dont the movement keys work in this:
Graphics3D 640,480
SetBuffer BackBuffer()
light=CreateLight()
camera=CreateCamera()
RotateEntity camera,5,0,0

Floor1=CreatePlane()
PositionEntity Floor1,0,-2,0
FloorTex=LoadTexture("floor.bmp")
EntityTexture Floor1, FloorTex

leftwall=CreateCube()
PositionEntity leftwall,-5,0,0








While Not KeyHit(1)
a3DmovementKeys(0.4, camera)


RenderWorld

Flip
Wend
End



Function a3DmovementKeys(speed, camera)
;up arrow
If KeyDown(200) MoveEntity camera,0,0,speed
;down arrow
If KeyDown(208) MoveEntity camera,0,0,-speed
;Left arrow
If KeyDown(203) MoveEntity camera,-speed,0,0
;Right arrow
If KeyDown(205) MoveEntity camera,speed,0,0
End Function



Aussie(Posted 2009) [#2]
Gday
You need to give speed a value


AJ00200(Posted 2009) [#3]
The speed is set to 0.4
a3DmovementKeys(0.4, camera)



Aussie(Posted 2009) [#4]
sorry didn't notice that. I just changed the value to 1 & it works

Edit: Put a # after all of your speed lables & it will work at .4


AJ00200(Posted 2009) [#5]
ok


AJ00200(Posted 2009) [#6]
Thanks


Kryzon(Posted 2009) [#7]
It doesn't work because the Speed needs to be set as Floating Point to accept values that are not whole numbers.

Speed = 0.5

Print Speed

the result is "0"

Speed# = 0.5

Print Speed

te result is "0.5"


GIB3D(Posted 2009) [#8]
You don't need to put # on every "speed" just the first one.

Function a3DmovementKeys(speed#, camera)