Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

create new ship

  • Loading branch information...
commit 6941a7e914701b82fa8bb0bb72ef697d641a576c 1 parent 827594e
@supercaracal authored
Showing with 30 additions and 1 deletion.
  1. +5 −1 test/shakedown-new-ship.html
  2. +25 −0 test/ship-navy.js
View
6 test/shakedown-new-ship.html
@@ -23,10 +23,14 @@
<script type="text/javascript" src="/js/sprite/i-field.js"></script>
<script type="text/javascript" src="/js/sprite/ship.js"></script>
+<script type="text/javascript" src="/test/ship-navy.js"></script>
<script type="text/javascript">
Event.observe(window, 'load', function() {
-
+ new Background().renderElement();
+ var ship = new ShipNavy();
+ ship.renderElement();
+ new Game(function() { ship.move(); }).start();
});
</script>
</head>
View
25 test/ship-navy.js
@@ -0,0 +1,25 @@
+var ShipNavy = Class.create(Ship, {
+
+ shadowSize : 20,
+ colors: ['FF0000', 'FF6600','FFFF00','00FF00', '00FFFF','0000FF','990099'],
+
+ getColor: function() {
+ return '#0F0F3F';
+ },
+
+ createElement: function($super) {
+ return $super().setStyle({color: '#FFFFFF'});
+ },
+
+ move: function($super) {
+ $super();
+ ++this.shadowSize;
+ var color = '#' + this.colors[0];
+ this.elm.down().setStyle({boxShadow: '0px 0px ' + this.shadowSize + 'px ' + color});
+ this.elm.down(1).setStyle({boxShadow: '0px 0px ' + this.shadowSize + 'px ' + color});
+ if (50 < this.shadowSize) {
+ this.shadowSize = 20;
+ this.colors.push(this.colors.shift());
+ }
+ }
+});
Please sign in to comment.
Something went wrong with that request. Please try again.