1 decade ago by Rapt
Hi, I'm new to javascript, and to impact.
I was trying to make my player to move crates which was very easy, but I want that when it tries to move a crate that is colliding with another one neither the crates nor the player can move. Like chon's boxes game
I had triying this
and some other varations of the same without any success any idea?
I was trying to make my player to move crates which was very easy, but I want that when it tries to move a crate that is colliding with another one neither the crates nor the player can move. Like chon's boxes game
I had triying this
collideWith: function(other,axis){ if(other.isBox){ var player = ig.game.getEntitiesByType( EntityPlayer )[0]; if(axis=='x'){ this.vel.x=-this.vel.x; other.vel.x=-other.vel.x; player.vel.x=-player.vel.x; this.vel.y=0; other.vel.y=0; player.vel.y=0; } } }
and some other varations of the same without any success any idea?