Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new file: lib/MyTankBotMad.js new file: lib/MyTankBotScared.js modified: lib/MyTankBotStill.js modified: lib/jsbattle.js modified: www/dashboard/dashboard.js modified: www/index.html
- Loading branch information
1 parent
54a06e9
commit a81bfe3
Showing
6 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* This is a definition of a user bot | ||
* aka this is to be written by user | ||
*/ | ||
|
||
var TankBot = require('./TankBot') | ||
var util = require('./util') | ||
|
||
var bot = TankBot.Bot.extend({ | ||
tick : function(){ | ||
if( Math.random() < 0.02) this.setSpeed(Math.random()*3-1.5); | ||
if( Math.random() < 0.02) this.turn(Math.PI); | ||
this._super(); | ||
}, | ||
}); | ||
|
||
module.exports = bot; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* This is a definition of a user bot | ||
* aka this is to be written by user | ||
*/ | ||
|
||
var TankBot = require('./TankBot') | ||
var util = require('./util') | ||
|
||
var bot = TankBot.Bot.extend({ | ||
tick : function(){ | ||
this.setSpeed(1); | ||
this._super(); | ||
}, | ||
/** | ||
* Handle collision with a wall | ||
*/ | ||
onHitWall : function(eventType, eventArgs){ | ||
this.turn(util.deg2rad(180)); | ||
}, | ||
/** | ||
* Handle collision with a bot | ||
*/ | ||
onHitBot : function(){ | ||
this.turn(util.deg2rad(40-80*Math.random())); | ||
} | ||
}); | ||
|
||
module.exports = bot; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
/** | ||
* This is a definition of a user bot | ||
* aka this is to be written by user | ||
*/ | ||
|
||
var TankBot = require('./TankBot') | ||
|
||
var bot = TankBot.Bot.extend({ | ||
tick : function(){ | ||
// TODO move this _super() at the begining of the function | ||
this._super(); | ||
} | ||
/** | ||
* The simplest bot | ||
*/ | ||
var botStill = TankBot.Bot.extend({ | ||
}); | ||
|
||
// to mixin TankBotPlugin into bot | ||
require('./TankBotPlugin').mixin(bot) | ||
|
||
module.exports = bot; |
This file contains 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
This file contains 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
This file contains 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