Skip to content

Instantly share code, notes, and snippets.

@nsmaciej
Last active January 2, 2016 01:18
Show Gist options
  • Save nsmaciej/8229078 to your computer and use it in GitHub Desktop.
Save nsmaciej/8229078 to your computer and use it in GitHub Desktop.
A very simple rotating turret for Spacejs.org
var turn = 20;
on('start', function(){
ship.ready();
});
on('turn', function(){
//Show current life
utils.print('Life' + ship.life)
//Turn by 20deg
ship.turn(turn);
//Fire the gun in direction of ship.angle after the turn.
gun.turn(ship.angle + turn);
gun.fire();
ship.ready();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment