1 decade ago by salsa
Hey guys, I use a video tutorial to create my first game, but i have a question...
In my game page i put a button with a jquery event, and i try to move a entity player...
but when i click that entity dont move...
anybody knows how i can set a entity position clicking on button?
i try:
jquery event:
thanks :)
In my game page i put a button with a jquery event, and i try to move a entity player...
but when i click that entity dont move...
anybody knows how i can set a entity position clicking on button?
i try:
ig.module(
'game.entities.main-player'
).requires(
'game.entities.player'
).defines(function(){
EntityMainPlayer = EntityPlayer.extend({
animSheet: new ig.AnimationSheet('media/player.png', 32, 32),
moveTest: function(){
this.vel.x = 100;
},
update: function(){
if (ig.input.state('up')){
this.vel.y = -100;
} else if (ig.input.state('down')){
this.vel.y = 100;
} else if (ig.input.state('left')){
this.vel.x = -100;
} else if (ig.input.state('right')){
this.vel.x = 100;
} else {
this.vel.y = 0;
this.vel.x = 0;
}
this.parent();
}
});
});
jquery event:
$(function(){
$('#ns').click(function(){
EntityMainPlayer.moveTest;
});
});
thanks :)
