Hello everyone (sorry for such a soon post) I'm struggling to get my head around how I would get the old positions in this code, how would I do it? My player never moves everything else does, so I need to get all the previous positions of everything else before they moved exactly before, not between each pressed on the keyboard
Here is example code:
Sync On : Sync rate 60
Type Objects
id as Integer
img as Integer
xpos as Integer
ypos as Integer
EndType
Global Map as Objects
Global Player as Objects
Player.id = 501
Player.img = 501
Player.xpos = screen width() / 2
Player.ypos = screen height() / 2
Map.id = 500
Map.img = 500
Map.xpos = 0
Map.ypos = 0
Load Image "player.png", Player.img
Load Image "background.png", map.img
Draw sprites first
Sprite Player.id, Player.xpos, Player.ypos, Player.img
Sprite Map.id, Map.xpos, Map.ypos, Map.img
Do
text 20, 20, "map.xpos: " + Str$(Map.xpos) + " map.ypos:" + Str$(Map.ypos)
UpdateWorld()
RenderWorld()
Sync
Loop
Function UpdateWorld()
if upkey() = 1
dec Map.ypos, 2
Endif
if downkey() = 1
inc Map.ypos, 2
Endif
if leftkey() = 1
dec Map.xpos, 2
Endif
if rightkey() = 1
inc Map.xpos, 2
Endif
Endfunction
Function RenderWorld()
Sprite Player.id, Player.xpos, Player.ypos, Player.img
Sprite Map.id, Map.xpos, Map.ypos, Map.img
Endfunction