There is your code rewriten by me where was needed:
`Main Source File
`Setup Enviroment
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
Position camera 0, 0, -100
Point camera 0, 0, 0
Autocam off
hide mouse
`Setup Variables
load image "grass1.BMP", 1
type player
x as float
y as float
life as float
endtype
global Main as player
global Mnumer
Main.x = 300
Main.y = 300
`endsetup
`Main
do
if keystate(31) = 1 then Main.y = Main.y + 1.0 `S
if keystate(30) = 1 then Main.x = Main.x - 1.0 `A
if keystate(32) = 1 then Main.x = Main.x + 1.0 `D
if keystate(17) = 1 then Main.y = Main.y - 1.0 `W
`RunAi()
Draw()
`RunEvent()
sync
loop
end
function RunAi()
endfunction
function RunEvent()
endfunction
function Draw()
cls
ink rgb(255, 0, 0), rgb(0, 255, 0)
circle Main.X, Main.Y, 100
`debug functions
set cursor 300, 300
text 0,0,"Main.x: "+str$(Main.x)
set cursor 300, 320
text 0,20,"Main.y: "+str$(Main.y)
`end debug
endfunction
function LoadCell()
if matrix exist(1) = 1 then delete matrix 1
make matrix 1, 2000, 2000, 20, 20
for x = 1 to 20
for y = 1 to 20
prepare matrix texture 1,1, x, y
next y
next x
endfunction
I have few thing i need to say to you.
First get rid of goto and gosub`s, this way of coding leads to bad habit using this commands which will most certainly let you down.Even in small test aplications you need to avoid using them.You`ll do favor to yourself believe me.
I don`t know but there is something wrong with tutorials in DBPro.Every newbie start with this bad habit using goto and gosubs.It happend to me also, and really fast abandon them.
Instead of using "print" command where is possible i prefer "text" command because it gives more freedom, you can place the text wherever you want.
Something very very important is to learn about how syncing works.Because you used "sync on", the program expect you taking care of syncs and there is no syncing at all in your program.Using sync off instead will make your aplication sync when it`s needed.When do use "sync on", be sure to put a "sync" in the end of your main loop.
Your keystates: WRONG!
I don`t know where you get this values and who told you that they was representing WASD controls.You can use CTRL+K for keystate helper or use Tools>Keystate Helper on the menu.It can give you right values when you hit a button.It produce even ASCII codes, if you needed them.In the past there was no keystate helper and i made program to produce values for me.It involves scancodes.Read about it.Try to make one Keystate Helper for yourself, to see how things work.
EDIT: About your WASD controls i just assumed you want them to do what i made them to do, you can invert them if that`s not the way you need them.
Best regards!
Where there is a will, there is a way.
I often edit my posts, that`s who i am