It's just a player and a block, I'm trying to make the block do what a block would do
GraphicsWindow.Width = 640
GraphicsWindow.Height = 480
GraphicsWindow.PenWidth = 1
GraphicsWindow.BackgroundColor = "Gray"
GraphicsWindow.KeyDown = KeyDown
GraphicsWindow.KeyUp = KeyUp
GraphicsWindow.BrushColor = "LightGreen"
player = Shapes.AddRectangle(32,32)
Shapes.Move(player,64,64)
px = 64
py = 64
speed = 3
GraphicsWindow.BrushColor = "LightGray"
block = Shapes.AddRectangle(32,32)
Shapes.Move(block,128,128)
isBlock[4][4] = "True"
'128/32=4
'128/32=4
While 1 = 1
Program.Delay(10)
If key["W"] And isBlock[rpx][rpy-1] <> "True" Then
py = py - speed
EndIf
If key["A"] And isBlock[rpx-1][rpy] <> "True" Then
px = px - speed
EndIf
If key["S"] And isBlock[rpx][rpy+1] <> "True" Then
py = py + speed
EndIf
If key["D"] And isBlock[rpx+1][rpy] <> "True" Then
px = px + speed
EndIf
Shapes.Move(player,rpx,py)
collision()
EndWhile
Sub collision
rpx = px / 32
rpy = py / 32
rpx = Math.Floor(rpx)
rpy = Math.Floor(rpy)
EndSub
Sub KeyDown
pressed = GraphicsWindow.LastKey
key[pressed] = "True"
EndSub
Sub KeyUp
pressed = GraphicsWindow.LastKey
key[pressed] = "False"
EndSub