05-15-2024, 12:21 PM
(05-15-2024, 07:37 AM)johnno56 Wrote: If one were to say, create a side scrolling Mario-type game that has a level much wider than the desktop, would there be such an example or tutorial on how to use the tilemap library to control the camera and scrolling? Just in case one were to consider such a project...
All I have is the Tilemap Editor PDF file as reference... No rush...
Herewith a simplified code if maps larger than the view
camera control : TM_CenterCamera(player.x + player.w/2, player.y + player.h)
Code:
...
'-----------
' MAIN LOOP
'-----------
while not keydown(KEY_ESCAPE, true)
' Control : LEFT, RIGHT to move horizontally
if keydown(KEY_LEFT) player.dx = -1
if keydown(KEY_RIGHT) player.dx = 1
if not keydown(KEY_LEFT) and not keydown(KEY_RIGHT) player.dx = 0
TM_MoveSprite(player, player.dx, player.dy)
TM_CenterCamera(player.x + player.w/2, player.y + player.h)
...
wend