Week 8 - Coin Collector

Coin Collector is procedurally generated platformer, where you jump, double-jump and wall-jump your way to collecting all the square coins. You can play it here

Coin Collector

why a platformer...

When I was working on Rogue Slasher with it's procedurally generated maps, I thought some of them looked like they'd make an interesting platformer map.

rogue slasher

The problem was that some spots would be very hard to reach with just a simple jump mechanic.

what I learned

How to expand on some of the basic platformer mechanics, in particular using the double-jump and wall-jump mechanic to get around the level. Originally, I had also wanted to include and in-air dash and a minimap but I just ran out of time, but something I'll probably implement in the future.

Since I was using CSV data to create the map I had to add the coin objects a different way.

    this.game.load.tilemap('level', null, cave, Phaser.Tilemap.CSV );
    this.map = this.game.add.tilemap('level', TILE_SIZE, TILE_SIZE);
    this.map.addTilesetImage('tiles'); //use generated sheet
    this.map.setTileIndexCallback(5, this.collectCoin, this);

Using tile callback so I could interact with the "coins". When I tile was hit, I'd call the collectCoin function.

  collectCoin: function(player,coin) {
    coin.index = FLOOR;
    this.layer.dirty = true;


Which would "pick it up" by setting the tile to be the same as the background tile and replotting the replaced tile using layer.dirty. As well, as playing the pickup sound and incrementing the picked-up coins counter.

other stuff

The source code is available on github here

Anyway, that's all for now. See ya in the next one :)