New Perl6 game: RetroRacer
Posted: 21/04/2014 Filed under: Perl | Tags: games, perl6, steroids Leave a comment(I’m really sorry for the name; I couldn’t think of anything better :))
This game, apart from (obviously) being a showcase for a new Steroids iteration, is all about switching lanes on a high traffic road in a fast car. Yay!
It’s really no rocket science compared to ThroughTheWindow from the last post – even code even looks similar. One obvious improvement (beside finally using proper PNGs instead of silly BMPs – timotimo++!) is a built-in collision detection:
my $s = self.add_sprite(‘othercar’, $_, 0);
# …
$s.when({ $_.collides_with($!player) }, {
# …
});
No more cheating with collisions like I did with ThroughTheWindow. The existing solution uses the entire image sprite as a hitbox; I’m hoping to make it customizable one day (it’s a simple thing really, code-wise).
All in all, the game isn’t all that much more sophisticated than the last one; I was really just looking for a good excuse to write a new game (and add some new stuff to Steroids), and I sort of came up with a nice theme to follow: ThroughTheWindow used just one key (spacebar), so the next step was to use two (thus RetroRacer) uses left and right arrow keys. What will the next game use? 3 keys? 4 keys? Is it an arithmetical or geometrical series? Oh my, I can’t wait to find out myself.
Now go and grab it at https://github.com/tadzik/RetroRacer, and don’t forget about the soundtrack!