Created
February 12, 2014 01:29
-
-
Save binjoo/8948250 to your computer and use it in GitHub Desktop.
JAVASCRIPT:CodeTank_BJ_V1坦克代码
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
/** | |
* CODETANK | |
* Copyright (c) 2012, Tencent AlloyTeam, All rights reserved. | |
* http://CodeTank.AlloyTeam.com/ | |
* | |
* @version 1.0 | |
* @author AlloyTeam | |
* | |
* .d8888b. 888 88888888888 888 TM | |
* d88P Y88b 888 ''''888'''' 888 | |
* 888 888 888 888 888 | |
* 888 .d88b. .d88888 .d88b. 888 8888b. 88888b. 888 888 | |
* 888 d88""88b d88" 888 d8P Y8b 888 "88b 888 "88b 888 .88P | |
* 888 888 888 888 888 888 88888888 888 .d888888 888 888 888888K | |
* Y88b d88P Y88..88P Y88b 888 Y8b. 888 888 888 888 888 888 "88b | |
* "Y8888P" "Y88P" "Y88888 "Y8888 888 "Y888888 888 888 888 888 | |
* | |
*/ | |
Jx().$package(function(J){ | |
var num = 1; | |
Robot = new J.Class({extend : tank.Robot},{ | |
/** | |
* robot主循环 | |
**/ | |
run:function(){ | |
this.setUI(tank.ui["green"]); //设置颜色 | |
this.loop(function(){ | |
this.say("我是墙头坦克~" + (++num),"#8fe543"); | |
this.ahead(1000); | |
}); | |
}, | |
/** | |
* 看到其他robot的处理程序 | |
**/ | |
onScannedRobot:function(e){ | |
this.say("孙子,别跑!","yellow"); | |
this.fire(1); | |
}, | |
/** | |
* 被子弹击中的处理程序 | |
**/ | |
onHitByBullet:function(e){ | |
}, | |
/** | |
* 和墙碰撞的处理程序 | |
**/ | |
onHitWall:function(e){ | |
}, | |
onRobotDeath:function(e){ | |
}, | |
/** | |
* 死亡的处理程序 | |
*/ | |
onDeath:function(e){ | |
this.say("我会回来的!","red"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment