pdiddles03

Transition between states

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. 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.