Last active
January 2, 2016 01:18
-
-
Save nsmaciej/8229078 to your computer and use it in GitHub Desktop.
A very simple rotating turret for Spacejs.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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