Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by ThatAnalog

As soon as the level starts, it's false. I registers as 'true' for one frame after I land from a jump, then it goes back to being false.

I set up the _wmBoundingBox property and it looks like everything is in order so I don't know what's going on here... anyone else having this problem?


I posted this in the forum too, but thought it would fit on here as well

1 decade ago by dominic

Have you had a look at the Jump'n'Run example from your download page? It's working there ;)

Post the update() method of your entity so we can have a look.

1 decade ago by ThatAnalog

Ya the thing is I had it working fine and then it just stopped, but I don't know why. The code is largely from Jesse Freeman's book but I had been modifying the controls, here's the code in its entirety-

update: function() {
// move left or right
console.log(this.standing)

var accel = this.standing ? this.accelGround : this.accelAir;

if( ig.input.state('left') ) {
this.vel.x = -accel;
this.flip = true;
}else if( ig.input.state('right') ) {
this.vel.x = accel;
this.flip = false;
}else{
this.vel.x = 0;
}
// jump
if( this.standing && ig.input.pressed('jump') ) {
this.vel.y = this.jump;

}

// shoot
if( ig.input.pressed('shoot') ) {
ig.game.spawnEntity( this.activeWeapon, this.pos.x, this.pos.y, {flip:this.flip} );
//this.shootSFX.play();
}
if( ig.input.pressed('switch') ) {
this.weapon ++;
if(this.weapon >= this.totalWeapons)
this.weapon = 0;
switch(this.weapon){
case(0):
this.activeWeapon = "EntityBullet";
break;
case(1):
this.activeWeapon = "EntityGrenade";
break;
}
this.setupAnimation(this.weapon);
}
// set the current animation, based on the player's speed
if( this.vel.y < 0 ) {
this.currentAnim = this.anims.jump;
}else if( this.vel.y > 0 ) {
this.currentAnim = this.anims.fall;
}else if( this.vel.x != 0 ) {
this.currentAnim = this.anims.run;
}else{
this.currentAnim = this.anims.idle;
}
this.currentAnim.flip.x = this.flip;
if( this.invincibleTimer.delta() > this.invincibleDelay ) {
this.invincible = false;
this.currentAnim.alpha = 1;
}
// move!
this.parent();
},

1 decade ago by ThatAnalog

a

1 decade ago by quidmonkey

Did you change your game's gravity? Did you override .handleMovementTrace()?

1 decade ago by ThatAnalog

I've figured it out- the problem was fixed when I reduced the 'friction : y' to 0. Although I don't really understand why.

1 decade ago by quidmonkey

Likely because your friction > gravity.
Page 1 of 1
« first « previous next › last »