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 Montana

Bug:
When going down a slope player is in "idle" state.
When going up a slope player is in "fall"state.

1.To reproduce build a small half pipe with slope tiles.
2. Run with no animations except fall.
3. See how the plyer animates when going up slope:
init: function( x, y, settings ) {
		this.parent( x, y, settings );
	
		
		// Add the animations
		this.addAnim( 'idle', 1, [0] );
		this.addAnim( 'run', 1, [0]);
		this.addAnim( 'jump', 1, [0]);
		this.addAnim( 'fall', 0.07, [0,1,2,3] );
	},


1.To reproduce build a small half pipe with slope tiles.
2. Run with no animations except idel.
3. See how the player animates when going down slopes:

init: function( x, y, settings ) {
		this.parent( x, y, settings );
	
		
		// Add the animations
		this.addAnim( 'idle',  0.07, [0,1,2,3] );
		this.addAnim( 'run', 1, [0]);
		this.addAnim( 'jump', 1, [0]);
		this.addAnim( 'fall',1, [0 );
	},

1 decade ago by drailing

hi,

i had similar issues, but i could fix it with small modification. you have to modify your animation assignments in you entity class.

this works for me:

if( this.vel.y < 0 && !this.standing) {
	this.currentAnim = this.anims.jump;
}else if( this.vel.y > 0 && !this.standing) {
	this.currentAnim = this.anims.fall;
}else if( this.vel.x != 0 && (ig.input.state('left') || ig.input.state('right') )) {
	this.currentAnim = this.anims.run;
}else{
	this.currentAnim = this.anims.idle;
}

the reason why slopes broke your animations, is that the velocity vector always going downwards a bit while standing on a slope, and y always > 0 if you going upwards
Page 1 of 1
« first « previous next › last »