http://littleroom.ca/zxc/gotstyle/
check the game. so each floor is a collision so entities can walk on it.
but I want to make the plant fall off the building after the player hit it.
how do I make it happen?
oh, press space to skip the entro screen.
Box2D physics would be your best bet.
If you just want the plants to drop through the floors when the Player hits them, override the update on your plant entity when the Player hits the plant.In effect stopping the trace against the collision map. Not sure Box2D would be any better as you would still Need the same sort of logic !.
Setup a property
hit:false
override update
update:function(){
if(this.hit==true) {
this.pos.x += this.vel.x * ig.system.tick;
this.pos.y += this.vel.y * ig.system.tick;
}
else {
this.parent( );
}
},
and Change the state of hit in the plants check
check:function(other){
this.parent(other);
if (other instanceof EntityPlayer){
this.hit=true;
}
}
Page 1 of 1
« first
« previous
next ›
last »