Return to Snippet

Revision: 49619
at July 27, 2011 00:25 by flipace


Updated Code
drawMapInterval = false;
drawMapIntervalKey = false;
var ms = 40
x = 0;

var cvs = document.getElementById('expcanvas');				
var ctx = cvs.getContext('2d');

speed = 10;

var game = new Jason(60);
game.addMap('map1','marioJump1-1.tmx',0,0);
game.maps['map1'].mapOffsetY=game.maps['map1'].mapheight*game.maps['map1'].maptileheight*-1+cvs.height;
game.addCharacter('mario',0,0,'walk_right',30);
game.addCharacterState('mario','walk_right','mario_char_walk_right_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','walk_left','mario_char_walk_left_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','duck_right','mario_char_duck_right.gif',18,21,0,21);
game.addCharacterProperty('mario','sound_jump',new Audio('Mario Jump.wav'));
game.addCharacterProperty('mario','sound_death',new Audio('Death.wav'));
game.addKeyEvent(39,'walk_right');
game.addKeyEvent(37,'walk_left');
game.addKeyEvent(38,'jump');
game.addKeyEvent(40,'duck');
			
$(document).keydown( function(event){
	if(event.keyCode==38 || event.keyCode==40 || event.keyCode==83){
		game.fireEvent(event.keyCode);
	}else{
		if(!drawMapInterval){
		drawMapIntervalKey = event.keyCode;
		drawMapInterval = setInterval(function(){
			game.fireEvent(event.keyCode);
		},ms);
		}
	}
});

$(document).keyup( function(event){ 
	if(event.keyCode == drawMapIntervalKey){
	if(game.characters['mario'].currentState=="duck_right"){
		game.characters['mario'].setState('walk_right');
	}
	game.characters['mario'].setAnimated(false);
	clearInterval(drawMapInterval);
	drawMapInterval=false;
	drawMapIntervalKey = false;
	}
});

Revision: 49618
at July 27, 2011 00:25 by flipace


Updated Code
drawMapInterval = false;
			drawMapIntervalKey = false;
			var ms = 40
			x = 0;
			
			var cvs = document.getElementById('expcanvas');				
			var ctx = cvs.getContext('2d');
speed = 10;

var game = new Jason(60);
game.addMap('map1','marioJump1-1.tmx',0,0);
game.maps['map1'].mapOffsetY=game.maps['map1'].mapheight*game.maps['map1'].maptileheight*-1+cvs.height;
game.addCharacter('mario',0,0,'walk_right',30);
game.addCharacterState('mario','walk_right','mario_char_walk_right_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','walk_left','mario_char_walk_left_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','duck_right','mario_char_duck_right.gif',18,21,0,21);
game.addCharacterProperty('mario','sound_jump',new Audio('Mario Jump.wav'));
game.addCharacterProperty('mario','sound_death',new Audio('Death.wav'));
game.addKeyEvent(39,'walk_right');
game.addKeyEvent(37,'walk_left');
game.addKeyEvent(38,'jump');
game.addKeyEvent(40,'duck');
			
$(document).keydown( function(event){
	if(event.keyCode==38 || event.keyCode==40 || event.keyCode==83){
		game.fireEvent(event.keyCode);
	}else{
		if(!drawMapInterval){
		drawMapIntervalKey = event.keyCode;
		drawMapInterval = setInterval(function(){
			game.fireEvent(event.keyCode);
		},ms);
		}
	}
});

$(document).keyup( function(event){ 
	if(event.keyCode == drawMapIntervalKey){
	if(game.characters['mario'].currentState=="duck_right"){
		game.characters['mario'].setState('walk_right');
	}
	game.characters['mario'].setAnimated(false);
	clearInterval(drawMapInterval);
	drawMapInterval=false;
	drawMapIntervalKey = false;
	}
});

Revision: 49617
at July 27, 2011 00:21 by flipace


Updated Code
speed = 10;

var game = new Jason(60);
game.addMap('map1','marioJump1-1.tmx',0,0);
game.maps['map1'].mapOffsetY=game.maps['map1'].mapheight*game.maps['map1'].maptileheight*-1+cvs.height;
game.addCharacter('mario',0,0,'walk_right',30);
game.addCharacterState('mario','walk_right','mario_char_walk_right_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','walk_left','mario_char_walk_left_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','duck_right','mario_char_duck_right.gif',18,21,0,21);
game.addCharacterProperty('mario','sound_jump',new Audio('Mario Jump.wav'));
game.addCharacterProperty('mario','sound_death',new Audio('Death.wav'));
game.addKeyEvent(39,'walk_right');
game.addKeyEvent(37,'walk_left');
game.addKeyEvent(38,'jump');
game.addKeyEvent(40,'duck');

$(document).keydown( function(event){
if(event.keyCode==38 || event.keyCode==40 || event.keyCode==83){
game.fireEvent(event.keyCode);
}else{
if(!drawMapInterval){
drawMapIntervalKey = event.keyCode;
drawMapInterval = setInterval(function(){
game.fireEvent(event.keyCode);
},ms);
}
}
});

$(document).keyup( function(event){ 
if(event.keyCode == drawMapIntervalKey){
if(game.characters['mario'].currentState=="duck_right"){
game.characters['mario'].setState('walk_right');
}
game.characters['mario'].setAnimated(false);
clearInterval(drawMapInterval);
drawMapInterval=false;
drawMapIntervalKey = false;
}
});

Revision: 49616
at July 27, 2011 00:11 by flipace


Initial Code
speed = 10;

var game = new Jason(60);
game.addMap('map1','marioJump1-1.tmx',0,0);
game.maps['map1'].mapOffsetY=game.maps['map1'].mapheight*game.maps['map1'].maptileheight*-1+cvs.height;
game.addCharacter('mario',0,0,'walk_right',30);
game.addCharacterState('mario','walk_right','mario_char_walk_right_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','walk_left','mario_char_walk_left_sprite.gif',18.5,32,0,146);
game.addCharacterState('mario','duck_right','mario_char_duck_right.gif',18,21,0,21);
game.addCharacterProperty('mario','sound_jump',new Audio('Mario Jump.wav'));
game.addCharacterProperty('mario','sound_death',new Audio('Death.wav'));
game.addKeyEvent(39,'walk_right');
game.addKeyEvent(37,'walk_left');
game.addKeyEvent(38,'jump');
game.addKeyEvent(40,'duck');
			
$(document).keydown( function(event){
	if(event.keyCode==38 || event.keyCode==40 || event.keyCode==83){
		game.fireEvent(event.keyCode);
	}else{
		if(!drawMapInterval){
		drawMapIntervalKey = event.keyCode;
		drawMapInterval = setInterval(function(){
			game.fireEvent(event.keyCode);
		},ms);
		}
	}
});

$(document).keyup( function(event){ 
	if(event.keyCode == drawMapIntervalKey){
	if(game.characters['mario'].currentState=="duck_right"){
		game.characters['mario'].setState('walk_right');
	}
	game.characters['mario'].setAnimated(false);
	clearInterval(drawMapInterval);
	drawMapInterval=false;
	drawMapIntervalKey = false;
	}
});

Initial URL

                                

Initial Description

                                

Initial Title
Jason Engine Super Mario 1

Initial Tags

                                

Initial Language
JavaScript