portals | gml
Add new objects objPortalA and objPortalB 20px width x 64px height:

objPortalA Create
global.portal_deactivate_timer = 30;
objPortalA Step
global.portal_deactivate_timer -= 1;
objPortalA Collision event with objPlayer
if (global.portal_deactivate_timer < 1){ global.portal_deactivate_timer = 30; objPlayer.y = objPortalB.y; objPlayer.x = objPortalB.x + (objPlayer.x-objPlayer.xprevious); }
objPortalB Collision event with objPlayer
if (global.portal_deactivate_timer < 1){ global.portal_deactivate_timer = 30; objPlayer.y = objPortalA.y; objPlayer.x = objPortalA.x + (objPlayer.x-objPlayer.xprevious); }
Challenge:
1. Implement the above code.2. CHALLENGE try making an "invisible portal". This is like a hidden portal that is a bonus for the player to find.
3. CHALLENGE if you can find the invisible portal, make it visible once found.
4. Find a cool, possibly animated sprite or appearance for your "portal".
5. Vertical portals... very difficult!