Although Metroid's map makes sense when you put it all together, it's not stored together in ROM, as far as I know; each room is its own thing. So you can't see the next room from the room you're in; going through a door loads the next room into RAM and transitions to the next room with a scrolling effect.

(Accidentally hit post on that one, but it was gonna be long as one post anyway.) Since I do have the map set up as one big contiguous area, Godot doesn't like that I want the camera to stop at the edge of a room and then go to the next room only when I enter it. So I've had to use some interesting tricks.

Right now, I'm drawing collision shapes onto each room. They're not solid; they just tell the engine when anything enters their space. Because Godot doesn't expose the absolute positions of collision shapes (you can get their dimensions, but not where they are in the scene), I'm also adding position markers at the top left and lower right of each room.

Godot does let you set camera limits, so it won't move past certain points in each direction (up, down, left, right) -- and you can set them programmatically. So here's the logic:

When Samus enters a room, that triggers an event on the room. The room gathers the X,Y positions of its TopLeft and BottomRight position markers, and communicates that to the camera. The camera then sets its limits to the top, left, bottom, and right of the current room.


There's a bit more to it than that; because Brinstar itself and Samus are each their own Scene object in Godot, and each are imported into the Main scene (Brinstar as a map, Samus as the player object), the Brinstar rooms and Samus's Camera object (which don't show up in the Main scene) can't talk to each other directly. So there's a chain of methods: the room informs Brinstar, Brinstar informs Main, Main informs Samus, and Samus informs her Camera. But it's a quick enough process that I'm not terribly concerned about it.

Sign in to participate in the conversation
Hic quoque abibit.

Just Ellie (and perhaps some of her toys).