Mega Man Screen Transitions (Again)

0 favourites
  • 4 posts
From the Asset Store
25 Royalty free tracks from 16 genres including western, sci-fi, war, mythical and many more.
  • An issue I've been facing for a VERY long time in the many issues I've used is making a Mega Man-style camera system. I know how to make the camera scroll when you go to the edge of the screen, but I don't how to properly make it follow the player or stop moving without either having a single pixel annoyingly jut out from the cut-off point or just break in general.

    A system I had in place in a previous project was a camera object that moves at a set amount of pixels when you go past its X region, but that caused a lot of issues since the character in it had momentum while moving. There were borders that when the camera object collided with would make the camera move back by the same amount of pixels, but ended up being very problematic in the end.

    Are there any good techniques that could help me solve this long-standing issue of mine?

  • Are all of your "screens" the same size between the camera pan transition? Are all of these "screens" contained on a single giant layout or are you using different layouts? Are you panning the camera to a new location in said layout, or are you moving the "level" around the viewport to give the feeling of scrolling through a giant level?

    I guess knowing a little more about how your game is set up would be beneficial to making a proper suggestion.

    Without knowing any of those things though, perhaps having a "state machine" set up for the player positioning - so you have for example;


    GlobalVariable.PlayerPosition = X (can be X or Y depending on your desired screen exit point)




    --- Scroll camera to X,Y

    --- Set ScreenState to 2



    --- Scroll camera to X,Y

    --- Set ScreenState to 3

    So for each of your screens, you're creating a custom "trigger" point that will cause the camera to shift X,Y coordinates to display your next area. Using this method you wouldn't be restricted to a set size for each "screen" - but you may be restricted to having one exit point only (or you could add a second variable to any specific screen state to compare X and Y, not just one or the other).

    As far as the scrolling thing goes, you can move the camera with lerp(camera.x,desired.x,1-0.2^dt) (and same for Y) for a smooth but fairly speedy transition. Rather than attaching the camera to the player itself - you would be setting this to hard coordinates on your map.

    Hope this helps


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The "screens" are all on one layout, and they are the size of the game's resolution (so if the game runs at 256x240, a stage with 2 screens would be 512x240 in size). What I'm doing is making the camera move throughout a large layout, but have spots where objects/event triggers stop it from moving until the player reaches the edge of the screen/hits an objects that triggers the camera to move.

    I've successfully set up a system for a vertical version, but that's mainly because in most games like Mega Man, the screen doesn't move vertically so the camera is completely static vertically until the player hits one of the spots that triggers the camera pan. Horizontally, though, I run into a bunch of issues since the camera has to be re-aligned to the player's X position. The effect I'm trying to go for looks like this:

    While I am capable of doing the screen pan, I can't for the life of me figure out how to get the camera to *stop* when it hits a "screen" border. As mentioned before, the camera would either be a single pixel off, leaving a tiny spot of that shouldn't be visible... well, visible.

  • Okay, it sounds like possibly you need to have two cameras... one that follows the player when needed, and the second camera that strictly controls the screen panning.

    You can change which camera is being followed when the screen pan needs to come into action.

    If you want to keep your screen relative position (so it doesn't 'jump' between the cameras) you would need to do a little math, offsetting the coordinates of the current position of the player camera vs the pan camera. You can track the position using instance variables, and do like; Follow object PanCamera.x-PlayerCamera.X (and same for Y).

    Something like that should give you the result you're looking for, I think.


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)