Jump to content

Transition between states


pdiddles03
 Share

Recommended Posts

Is there a way to create  an effect like something you would see on Mega Man on the NES? Each Level would have  multiple sections and once you reach the end of a section, the screen animations to the next.  Does this make any sense?  Preferably i would like these  sections programmed with the Tiled map editor program. 

Link to comment
Share on other sites

One way to do it is to define sections as rectangles and check the player position against that. When you enter a new rectangle you tween the bounds from what they are to the new rectangle. I think you might need a temporary rectangle and tween the coordinates of that and copy it's values to the bounds on each update. Also you'll gonna need some tweaking to avoid tweening values that's outside what you see, or else you'll do a lot of unecessary tweening when entering a long/high corridor.

Link to comment
Share on other sites

  • 2 weeks later...

Just coordinates. Define minX,minY, maxX and maxY (or x,y,width,height) for each "room" and check the player position against those rectangles. When you move between rooms you tween such a rectangle from original bounds to the desired ones and constantly set the real world bounds to match that rectangle in the update-loop. Sorry for being cryptic, you'll have to translate it to code yourself. This how it works in my partial metroid remake at http://metroid.niklasberg.se

Link to comment
Share on other sites

Thanks. Actually it started out just as a test to render the map and doing the transitions we're talking about. Like a map navigator. But then I started to add stuff just for fun and it grew until I got where it is now, needless to say, the source is messy.

I hope to begin something similar but original with Phaser 3 when it's ready and then I might do a room transition plugin and share it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...