Hi evilmaio,
Thank you for your code snippet, I will try it out shortly.
The reason I created a delay function was mainly for the numkeypress because as I move my character around the grid he moves too quickly,
(at the slightest key touch the character will move 4 cells and if one of these cells is a no go area he will die, idealy I would like to move one cell at a time)
I have a delay at the end of each input:
If (numkeypress(******())>0)
-- some code
keydelay(15)
end
In VB6 my key input routine would use vbKeyUp with a DoEvents in a loop, the vbKeyUp is not the same as your's it is when the key is released, the DoEvents
allows other program code to continue.
How would you handle moving the character one cell at a time?
Here is my move right code sorry tabs dont seem to work in this area:
if (numkeypress(keyright()) > 0) then --------- KeyRight **************
if manposx == 15 then return true end
tile = gridcell(grid,manposx + 1, manposy)
if tile == 2 then return true end --wall detected
manwalking = true
------------------------- move a boulder ---------------
gridcell(grid,manposx, manposy, 9) --Walk right
if tile == 3 then --boulder
gridcell(grid,manposx, manposy, 7) --push right
test = gridcell(grid,manposx + 2, manposy)
if test ~= 0 then return true end
gridcell(grid,manposx + 2, manposy, 3)--boulder
gridcell(grid,manposx + 1, manposy, 7)--push reght
end
------------------------ collect a gem -----------------
if tile == 4 then
playsound(ding)
end
--------------------------------------------------------
gridcell(grid,manposx + 1,manposy,9)
gridcell(grid,manposx,manposy,0)
manposx = manposx + 1
debug("manposx = " ..manposx)
keydelay(15)
manwalking = false
end----------------- end if keyright ----------------------------------