Please! Help Me!

Blitz3D Forums/Blitz3D Beginners Area/Please! Help Me!

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.

I am making a 3d game where the player moves like pacman,
accept with the addition of diagonal movement.
The controls are w,s,a,d,wa,wd,ds,as. All four single buttons work fine and wa and wd works as well.
The problem is that the ds,and as, combos move it at twice the speed as it should and moves it in the wrong direction.
I have tried everything I could think of and am verry fustrated but realy would like to finish a game!
can someone please help me?
I have assembled part of the program with the problem function.

 Graphics3D 640,480 
;Graphics3D 800,600 

SeedRnd MilliSecs()
plane = CreatePlane()

cl=1
Global light=CreateLight(1)
LightConeAngles light,1,30
LightRange light,125 
Global cam=CreateCamera()
Global sphere=CreateSphere()
ScaleEntity sphere,3,3,3 

Global camangle 
camangle=0 

Global rsx#= .50 ;right movment value 
Global lsx#=-.50 ;left movment value 

Global fsz#=-.50 ;forward movement value 
Global bsz#= .50 ;back movement value
Global ROBOX = CreateCube ()

EntityShininess ROBOX,1 


;ROBOX = LoadMesh("data\boxmsh.b3d")
PositionEntity ROBOX,EntityX(sphere),EntityY(plane),EntityZ(sphere)
ScaleEntity ROBOX,.1,.1,.1 
Global dirbox = CreateCube ()
EntityAlpha dirbox,.5
Global pointer = CreateCube ()
EntityAlpha pointer,.5
;PositionEntity dirbox,EntityX(sphere),EntityY(sphere)+5,EntityZ(sphere)+5
;EntityBox ROBOX,-.05,-.05,-.05,.1,.1,.1
EntityRadius ROBOX,5 

EntityType ROBOX,4 


PositionEntity cam,EntityX(sphere)-20,EntityY(plane)+40,EntityZ(sphere)-20


While Not KeyHit(1)



PointEntity cam,sphere
test_input(rsx#,lsx#,fsz#,bsz#)


RenderWorld


UpdateWorld
Flip 
Wend
ClearWorld()
 
End






Function test_input(rsx#,lsx#,fsz#,bsz#) 


;check for movement by user
;needs a point entity comand for the robox turn methodiology mophisizm
 

;32=right,17=forward,31=back,30=left
;1 invisable boxes north south for control of robot


;to be testinput function



If KeyDown(17)=False  And KeyDown(30)= True  Then ;left a
 PositionEntity dirbox,EntityX(sphere)+45,leval#,EntityZ(sphere)  
 TranslateEntity sphere,lsx#*2,0,0:PointEntity ROBOX,dirbox
 PositionEntity pointer,EntityX(sphere)-45,leval#,EntityZ(sphere)
 PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
 PointEntity light,pointer
End If   
 

If KeyDown(17) = False And KeyDown(32) = True Then ;right
  PositionEntity dirbox,EntityX(sphere)-45,leval#,EntityZ(sphere)
  TranslateEntity sphere,rsx#*2,0,0:PointEntity ROBOX,dirbox
  PositionEntity pointer,EntityX(sphere)+45,leval#,EntityZ(sphere)
  PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
  PointEntity light,pointer
End If
 
;rsx#= .50 ;right movment value 
;lsx#=-.50 ;left movment value
;fsz#=-.50 ;forward movement value 
;bsz#= .50 ;back movement value
 
;usy#=-.50 ;up movement value 
;dsy#= .50 ;down movement value

   ;If KeyDown(17) = True Then ;forward w
If KeyDown(17)=True And KeyDown(30) = True Then ;leftforward q
  PositionEntity dirbox,EntityX(sphere)+45,leval#,EntityZ(sphere)-45
  TranslateEntity sphere,lsx#,0,bsz#:PointEntity ROBOX,dirbox 
  PositionEntity pointer,EntityX(sphere)-45,leval#,EntityZ(sphere)+45
  PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
  PointEntity light,pointer
 
Else If KeyDown(17) = True And KeyDown(32) = True
  PositionEntity dirbox,EntityX(sphere)-45,leval#,EntityZ(sphere)-45
  TranslateEntity sphere,rsx#,0,bsz#:PointEntity ROBOX,dirbox 
  PositionEntity pointer,EntityX(sphere)+45,leval#,EntityZ(sphere)+45
  PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
  PointEntity light,pointer

Else If KeyDown(17)=True 					;entityY(plane)
 PositionEntity dirbox,EntityX(sphere),leval#,EntityZ(sphere)-45
 TranslateEntity sphere,0,0 ,bsz#*2:PointEntity ROBOX,dirbox
 PositionEntity pointer,EntityX(sphere),leval#,EntityZ(sphere)+45
 PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
 PointEntity light,pointer
End If 
;rsx#= .50 ;right movment value 
;lsx#=-.50 ;left movment value
;fsz#=-.50 ;forward movement value 
;bsz#= .50 ;back movement value
 
;rsx#= .50 ;right movment value 
;lsx#=-.50 ;left movment value
;fsz#=-.50 ;forward movement value 
;bsz#= .50 ;back movement value
 
;usy#=-.50 ;up movement value 
;dsy#= .50 ;down movement value
If KeyDown(31) = True And KeyDown(30)=True Then ;left aw
 PositionEntity dirbox,EntityX(sphere)+45,leval#,EntityZ(sphere)+45  
 TranslateEntity sphere,lsx#,0,fsz#:PointEntity ROBOX,dirbox
 PositionEntity pointer,EntityX(sphere)-45,leval#,EntityZ(sphere)-45
 PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
 PointEntity light,pointer

Else If KeyDown(31) = True And KeyDown(32)=True Then ;right dw
 PositionEntity dirbox,EntityX(sphere)-45,leval#,EntityZ(sphere)+45  
 TranslateEntity sphere,rsx#,0,fsz#:PointEntity ROBOX,dirbox
 PositionEntity pointer,EntityX(sphere)+45,leval#,EntityZ(sphere)-45
 PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
 PointEntity light,pointer
 
 
Else If KeyDown(31) = True Then  ;back s
 PositionEntity dirbox,EntityX(sphere),leval#,EntityZ(sphere)+45   
 TranslateEntity sphere,0,0,fsz#*2:PointEntity ROBOX,dirbox 
 PositionEntity pointer,EntityX(sphere),leval#,EntityZ(sphere)-45
 PositionEntity light,EntityX(sphere),leval#,EntityZ(sphere)
 PointEntity light,pointer
End If




End Function