Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling
#1
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...
Logic is the beginning of wisdom.
Reply
#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
#3
Here's an example using graphics from Super Mario Bro's 2. If something is unclear, just ask Smile


Attached Files
.zip   mario2.zip (Size: 4.76 KB / Downloads: 6)
Reply
#4
Excellent! As we say here in Australia, "Your blood is worth bottling". (https://www.usingenglish.com/reference/i...tling.html)
Logic is the beginning of wisdom.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)