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 paulh

I was expecting the following code (even without changing gravity) to make the player float right at a constant height and velocity .. any ideas why the player "drops down"?



ig.module(
	'game.entities.rgustus'
)
.requires(
	'impact.entity'
)
.defines(function(){

EntityRgustus = ig.Entity.extend({
	_wmScalable: true,
	_wmDrawBox: true,
	_wmBoxColor: 'rgba(25, 20, 260, 0.7)',
	
	checkAgainst:ig.Entity.TYPE.A,
	update: function(){},
	
	check: function(other){
	other.gravityFactor =0;
	other.vel.x = 150;
        other.pos.y =200;
	ig.game.gravity = 0;
	}
})
});

1 decade ago by SlouchCouch

gravity may be shut off but I think there might still be some y component of his velocity. try zeroing other.vel.y (i'm assuming that's the player) out in the check function as well. also you wouldn't have to zero out the game's gravity, just the player's gravityFactor should suffice.

1 decade ago by paulh

Doh! Your right, thx .. silly me :-)
Page 1 of 1
« first « previous next › last »