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 Derek

Hey there,

Thanks again for this great tool! I have been having tons of fun the past few days working on an old-style top down rpg.

There's one thing I can't quite figure out that would make my life a lot easier. Is there a way to automatically set collision on the edge of the map, so the player can't walk into the void? Currently I have to go around the edge of each map with the Stop tile.

Thanks in advance,
Derek

1 decade ago by quidmonkey

In your player.update() do something like this:

this.parent();

if( this.pos.x < ig.game.screen.x ){
    this.pos.x = ig.game.screen.x;
}
if( this.pos.x + this.size.x > ig.system.width){
   this.pos.x = ig.system.width - this.size.x;
}
if( this.pos.y < ig.game.screen.y ){
   this.pos.y = ig.game.screen.y;
}
if( this.pos.y + this.size.y > ig.system.height ){
   this.pos.y = ig.system.height - this.size.y;
}

Best.
Page 1 of 1
« first « previous next › last »