hero extends shapes.circle
i create a new ContactList like this
Code:
contacts = new ContactList();
contacts.listenTo(this);
i have tried
Code:
contacts.update();
and
Code:
contacts.clean();
before and after jumping. still seems to act odd.
so i told it to flip scaleX of all bodies on the contact list with each jump (each wall is a seperate shapes.Box body.)
please notice that there are often many walls being flipped that the hero is no where near in contact with.
am i doing something wrong or is ContactList broken in some way?
i tried the dot manifold system that was in the demo boxMan, and currently have dumbed it down to isGround (which each horizontal wall is set to true) and then i noticed there were walls in my contact list that im not near.
Code:
private function canJump():Boolean{
if(getTimer() - jumpDelayCount < jumpDelay) return false;
var manifold:b2WorldManifold = null;
var dot:Number = 9.5;
var isGrounded:Boolean = false;
if(!contacts.isEmpty()) {
contacts.forEach(function(keys:Array, c:ContactEvent) {
var otherShape:* = c.other.m_userData;
var otherBody:* = otherShape.body;
if(otherBody.isGround){
isGrounded = true
}
otherBody.scaleX *= -1
});
}
return isGrounded;
}
i will probably switch back to the dot manifold system which checks the direction of the contact after i get the contact list issue resolved. currently I'm not able to make heads or tails of this.
thanks for your time, hope I'm just missing something silly.