Metroid Scrolling

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
anwerman
Posts: 7
Joined: Thu Jun 17, 2010 9:09 pm

Metroid Scrolling

Post by anwerman » Fri Jun 25, 2010 3:47 pm

Hello everyone :)

I've been doing more research on how to implement scrolling on my NES-like XNA project, and this has led me to the game Metroid.

http://metroid-database.com/m1/lvldata.php

In theory - I have yet to program them but have the data marked up and documented - my maps would run just like in Metroid. Independent of each other but the game would scroll from one map to the next.

I have conceptualized and jotted down how collision detection would work. I'm just stumped how the developers programmed scrolling with the PPU. E.g., if there isn't a level to the left, stop scrolling left. Or move the camera right when the character is in the middle of the screen.

Stuff like that - in addition, remembering which column to draw onto the PPU nametables when the character moves left and right.

Any enlightenment?

User avatar
tokumaru
Posts: 11990
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru » Fri Jun 25, 2010 4:04 pm

IMO, the best way to handle scrolling is to create a camera object, and let it be responsible for all the background movement and rendering. You can easily customize everything you need about the scrolling by programming the behavior of this camera.

The simplest possible camera will follow the player and try to keep him at the center of the screen. For this the camera must keep track of the position of the character within the level and update it's own coordinates accordingly. If the camera tries to scroll into an are where it's not allowed to, it should stop and let the player be away from the center.

A camera object also serves as a reference for drawing sprites. Since the camera - like any other object - has a position within the level, you can use the relative position of other objects to it to find the absolute screen position where they must be displayed.

sleepy9090
Posts: 81
Joined: Fri Aug 22, 2008 10:04 am

Post by sleepy9090 » Thu Jul 01, 2010 8:27 am

stumbled upon this over at romhacking.net, dunno if it would help you any but might be worth a look



http://www.romhacking.net/docs/459/

Post Reply