I tried this:
Type Vector3D
Field x#=0.0
Field y#=0.0
Field z#=0.0
End Type
Type Player
Field uType = 0
Field uState = 0
Field uPosition.Vector3D
Field uV.Vector3D
Field uA.Vector3D
Field uF.Vector3D
Field uJump = 0
Field uFall = 0
Field uAction1 = 0
Field uAction2 = 0
Field uAction3 = 0
End Type
Function MainLoop()
SetBuffer BackBuffer()
Repeat
Cls
MovePlayer()
If KeyHit(1)
End
EndIf
DrawImage player,vPlayer\uPosition\x,vPlayer\uPosition\x
Flip
Forever
End Function
Function MovePlayer()
If JoyY(0) = "-1.52588e-005"
jSigY = 0
Else
jSigY = JoyY(0)
End If
If (vPlayer\uPosition\x + (jSigX * joyFactor)) < 0
vPlayer\uPosition\x=1
Else If (vPlayer\uPosition\x + (jSigX * joyFactor))+ImageWidth(player) >= GraphicsWidth()
vPlayer\uPosition\x = GraphicsWidth()-ImageWidth(player)
Else
vPlayer\uPosition\x = vPlayer\uPosition\x + (jSigX * joyFactor)
End If
If velocityY < velocityMax
velocityY = velocityY + acceleration
End If
If jSigY<0 And (velocityY > -velocityMax)
velocityY = (-velocityY)
End If
If (vPlayer\uPosition\y + (velocityY)) < 0
vPlayer\uPosition\y = 1
Else If (vPlayer\uPosition\y + (velocityY))+ImageHeight(player) >= GraphicsHeight()
vPlayer\uPosition\y = GraphicsHeight()-ImageHeight(player)
Else
vPlayer\uPosition\y = vPlayer\uPosition\y + velocityY
End If
End Function
No syntax errors but the code instantly crashes at runtime on Win7. Maybe thatīs already enough to meet the limits of "You better donīt use types with large numbers of objects".
|