Chronotron Flash game prototype

Do you remember Chronotron?

It’s a puzzle platform which wants you to interact with past versions of yourself to solve levels. It’s a very original game, higly recommended

chronotron

Luis Fernando Silva, author of a Box2D platform engine alternative published on the blog some time ago, created a prototype of this game

« I really liked how this prototype turned out and I hope it might help someone out. Maybe a more creative coder might even improve it!

Anyways, for the past few days, I’ve been wondering how to achieve the cool time-warped NPC that repeats all you did on a past run of a level, like on Chronotron and Mouse 10*, I was shooting some thoughts on FGL chat and the idea of using arrays to store player input in an Array and make the NPC replay it came to mind. I started discussing the idea and it gained shape as I and the chat folks talked about the possibilities.

I decided I already had a good base to start coding on, and I promotly started scripting down in Flash. At the beggining, it was hard to code this, there was some issues with the way the input was ordered on the replay array, so I had to create a function to place it in the correct order, along with an issue the way the NPC interpreted it. But after many issues, troubles, crashes and bug testing, the thing is here! And it works (almost) flawlessly! »

The main file is on the timeline and it’s fully commented:

And this is the result:

Move the main rectangle with left and right arrow keys, and when the upper timeline is over, watch for you chrono clone.

Download the source code and let me know if you improve it somehow

  • Yep, that’s pretty close to how I did it. I used OOP, Player and PastSelf both inherited from a superclass. The only difference was that Player acted on input from the keyboard and recorded it, and PastSelf acted on input from the array generated by the player. Using the time machine meant the player and past self always started at the same point, so no need to record the (x,y) coords except for the “teleport” effect that happens when you move while time is frozen.

  • Also, some extra instructions to get the thing working correctly on a game:

    The Mc_Player is the char controlled by the player. On it, you’ll find the stepPlayer() function. Inside it, there are a few key checks placed already (left and right arrow keys).

    In order to make both NPC and player work the exact same way, just use the keyDown() event to detect and work out the controls on the stepPlayer(), and then copy the entire script over to the stepNPC() function on the Mc_NPC movieclip (leave room to call the runNPC function at the start of the loop!).

    Thanks you all!

  • Have you looked at your site in Firefox today?

  • Guest

    There are many flash games/applications (even greeting cards) where you can Draw in flash, save the drawing (all the process not just the final result) and then load it and show the drawing process…. in those games, you record the (x, y) positions of the mouse in one array, i guess it’s something similar here? am i right?

  • Yes, the method is almost the same.

  • slc

    I want to make simple car racing game for my little brohter on cs3 flash . So that if you have simple type of scripts of game please help me by sending in my email address.

  • David

    I am a little curious about Flash.
    I very dreams with games and programming in Flash. I’ve thought up to create a an online game, who also has dreams of Flash?
    Putting everything you taught him to have almost any experience to create a very good game.
    Thank you for creating the site.

  • Sam

    it reminds me of Ratchet & Clank A Crack In Time, with the clank parts