Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

361 Neutral

About Maxamor

  • Rank
  1.   Most large things start off small and grow large over time.         I like to think of the player and enemies as puppets, and the level is a stage -- without a puppet master they don't do much. I would put this logic in the GameState or whatever "knows" about both the player and the level.   In my game, a "Room" is essentially the same as your "LevelSection" idea. When the player collides with a transition region, a change is made to signal that a "transition" is happening, then the game figures a few things out: The direction of the transition (upwards, rightwards, downwards, leftwards) The position of the next room If you know both of these things, then it's pretty easy to decide what to do next. While the "transition is happening now" flag is true you shift the camera a little bit in the direction of the next room. For Mega Man, according to my measurements, the camera moves 4 pixels-per-frame horizontally or 3 pixels-per-frame vertically while transitioning (at 60 frames per second). As you move the camera, you'll eventually move all the way to the next room -- so you basically just keep moving until you've positioned the camera exactly where you want it. Once the camera has moved to the desired location you unset the "transition is happening now" flag and everything goes back to normal. Since you know the position of the room and the position of the camera it is easy to tell when you've hit your goal.   As for moving the player, you do the same thing as with the camera but with a smaller amount of movement. I let my "game state" perform this movement -- my player object doesn't know its being moved because it isn't being updated during transitions.   Obviously, my actual implementation is a bit more complex than what is explained above -- but at the highest level that's what happens.
  2. I'm writing a Mega Man clone right now and have implemented the screen transitions. You can see videos with the transitions here:     The way that I implemented it is to split up the level in to rectangular "rooms". When two rooms connect it gives you an opportunity to perform a transition. Each room has a list of "Transition Regions" which are more-or-less just a rectangle and a transition direction. So if Mega Man is in room #1 then I only check if he's touching transition regions from that room. Once he touches one, a transition is triggered and once it finishes he is now in a different room. Once you're in a different room you only need to check for collisions between transition regions in that room. This allows you to implement both one-way and two-way transitions and prevents you from constantly transitioning back-and-forth in some other cases.   Rather than using magic tiles or "outside of the map" triggers, I would suggest you use a method as I described. It's not a lot of work and it's flexible. I came up with this solution after asking the same question on the Game Development Stack Exchange site: http://gamedev.stackexchange.com/questions/6712/mega-man-style-screen-scrolling-design.   Essentially the design looks something like this:     As for "where does the code that does the camera movement go", well, that's up to you. I have a class where the "game play" takes place and I handle the screen scrolling there. When you collide with a transition region it sets a flag that says "a transition is happening now". When that flag is true the screen scrolls to the next room. Once you get to the next room it sets the "transition is happening now" flag to false. That way you can "disable" game play while the transition is happening.     That's what I do when my "transition is happening now" flag is true. I don't think it's the Player's responsibility to know about transition movements -- something else should do that.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!