Quote: "Well the reason i used 1.5 is because 2 seemed fast and 1 seemed slow. thats why i startd using floats."
Ah OK - I understand now!
Using floats is OK, but you would be better off using timers or at the least, some form of counter which stops the position incrementing routine from being called EVERY time you go around the main loop.
Basic example:
Set Display Mode 800,600,32
Sync On: Sync Rate 0: CLS 0: Sync
Hide Mouse
X=400: Y=300: SpriteSpeed=40: Rem <<< Lower this value to increase speed
Rem Make Something To Move...
Ink RGB(0,255,0),0
Box 0,0,16,16
Get Image 1,0,0,16,16
CLS
Ink RGB(255,255,255),0: Text 5,5,"Move Sprite With Cursor Keys"
Rem Main Program Loop
MoveTimer = Timer()
Do
T = Timer()
If T - MoveTimer >= SpriteSpeed
Gosub MoveChar
MoveTimer = Timer()
Endif
Sync
Loop
End
MoveChar:
If UpKey() = 1 Then Dec Y,5
If DownKey() = 1 Then Inc Y,5
If LeftKey() = 1 Then Dec X,5
If RightKey() = 1 Then Inc X,5
Sprite 1,X,Y,1
Return
The advantage of this method is that the object moves at the same speed on every machine regardless of how fast or slow it is.
You also have full control of the object's speed. Using a variable like SpriteSpeed (or an element of an integer array) you can increase and decrease it's speed at will at any point in the game.
Note: You can create other timers (like MoveTimer) in the same way for other tasks.
TDK