Ok so I have a repeating background and the player is constantly moving to the right. Now I would like there to be some kind collision boxes at both the bottom and the top of the map. I couldn't think of a good way to do this, if you could make a repeating collision layer like you can with a background, I would be perfect, but you can't. Anyone have any ideas as to what I should do?
check to ensure the player is in the bounds of the map.
update: function(){
...
if (this.pos.x <= 32){
this.pos.x = 32; // set the player to the left most possible value
}
if (this.pos.x >= 360){
this.pos.x = 360; // set the player to the right most current value
}
},
just find your upper limit and lower limit and set the y pos accordingly. try ig.system.height - this.size.y and 0 + this.size.y. 0 will most likely be your upper offset if you are doing a side scrolling map as i believe the map starts at axis 0,0.
let me know if this doesn't work or if you need further help.
Page 1 of 1
« first
« previous
next ›
last »