Posts Tagged ‘timers’

  • Phaser Coding Tips 6

    Phaser Coding Tips is a free weekly email – subscribe here.



    Back in the late 80s I was utterly captivated by an Usborne range of programming books, one of which was Computer Battlegames (for the ZX Spectrum, et all).


    The front cover and illustrations within this book promised great things! In reality only one game in the entire book even had any graphics (everything else was text mode). But that didn’t stop it firing my imagination.

    For this weeks coding tip I’ve taken one of the games from the book and bought it into Phaser.

    Get the source

    I’m only going to highlight the most important parts of the code here. So please always look at the source first. If you’ve questions about something I didn’t cover then ask on the forum.

    Run / Edit the code on jsbin or codepen

    Clone the phaser-coding-tips git repo.



    “You are standing back to back. You take 10 paces, turn and reach for your guns. How quick are you? Can you shoot first?”

    That was the blurb from the original game in the book. It accompanied 15 lines of code and a lavish spaghetti western style illustration. For our rendition Ilija has given it a pixel art look instead.


    The game consists of just 1 image, which we’ll change the texture of, some text and a bunch of timers to handle the shooting.
    Read More