Skip to content

Commit

Permalink
moved snake starting position to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
erdbeerschnitzel committed Feb 26, 2012
1 parent 66d5594 commit 86d4b1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Snake.dart
Expand Up @@ -2,15 +2,18 @@ class Snake {

int lenght = 10;
int width = 10;
int pos_X = 25;
int pos_Y = 25;
int pos_X;
int pos_Y;
int points = 0;
String direction = 'right';
String color = 'black';
String pending_direction = 'right';

Snake(){

pos_X = 25;
pos_Y = 25;

}

bool catches(Ball ball){
Expand Down
6 changes: 3 additions & 3 deletions mc1.dart.js
Expand Up @@ -6476,7 +6476,7 @@ mc.prototype.drawSnake = function() {
html_get$document().get$on().get$keyPress().remove(this.get$onKeyPress(), false);
}
else {
this.writeStatus($$add(" " + drawingArea.get$width(), " -> ") + drawingArea.get$height());
this.writeStatus($$add($$add($$add($$add($$add("ball pos: " + this.ball.pos_X.toInt(), ", ") + this.ball.pos_Y.toInt(), " to the "), this.snake.direction), " --> x: ") + this.snake.pos_X, " y: ") + this.snake.pos_Y);
}
}
mc.prototype.get$drawSnake = function() {
Expand Down Expand Up @@ -6523,12 +6523,12 @@ mc.prototype.get$onKeyPress = function() {
function Snake() {
this.lenght = (10);
this.width = (10);
this.pos_X = (25);
this.pos_Y = (25);
this.points = (0);
this.direction = "right";
this.color = "black";
this.pending_direction = "right";
this.pos_X = (25);
this.pos_Y = (25);
}
Snake.prototype.get$width = function() { return this.width; };
Snake.prototype.catches = function(ball) {
Expand Down

0 comments on commit 86d4b1a

Please sign in to comment.