Skip to content

Instantly share code, notes, and snippets.

@klustig88
Created September 25, 2013 21:05
Show Gist options
  • Save klustig88/6706049 to your computer and use it in GitHub Desktop.
Save klustig88/6706049 to your computer and use it in GitHub Desktop.
java_racer js
// function Player(name, strip){
// this.name = name;
// this.current_position = 1;
// this.strip = strip;
// this.finished = false;
// }
// Player.prototype.move() = function(){
// $("#player"_+ this.strip + "_strip ." + (this.current_position - 1) + " img").attr('src', "mushroom.jpeg");
// $("#player" + this.strip + "_strip ." + (this.current_position) + " img").attr('src', this.photos[this.strip]);
// this.current_position += 1;
// }
// Player.prototype.check_finish = function() {
// if (this.current_position === 9) {
// player.finished = true;
// }
// };
// Player.prototype.photos = {
// 1 : "Mario.png",
// 2 : "luigi.jpeg"
// }
function Player(name,strip){
this.current_position = 1;
this.strip = strip;
this.name = name;
this.finished = false;
}
Player.prototype.move = function(){
$("#player" + this.strip + "_strip ." + (this.current_position - 1) + " img").attr('src',"mushroom.jpeg");
$("#player" + this.strip + "_strip ." + this.current_position + " img").attr('src', this.photos[this.strip]);
this.current_position += 1;
};
Player.prototype.check_finish = function(){
if (current_position === 9 ){
player.finished = true;
}
};
Player.prototype.photos = {
1 : "Mario.png",
2 : "luigi.jpeg"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment