Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling
#2
(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


Attached Files
.zip   platformer_step_5_simplified.zip (Size: 16.83 KB / Downloads: 3)
Reply


Messages In This Thread
Scrolling - by johnno56 - 05-15-2024, 07:37 AM
RE: Scrolling - by 1micha.elok - 05-15-2024, 12:21 PM
RE: Scrolling - by Marcus - 05-15-2024, 04:35 PM
RE: Scrolling - by johnno56 - 05-15-2024, 06:25 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)