Is there a way to bound the player to the viewport?
I'm adapting my game to play on several screen resolutions, so bounding the player to the layout won't work because the screen might be larger than the layout and I can't make the player solid because of the game mechanic.
You could try something like this..
Aslong you are not using Scrollto or camera behaviors on your player and don't want your layout to scroll beyond the viewport...
System> Compare two values
> Player1.Y > 'viewportBottom'
>> set player.y to viewportBottom
> Player1.Y < 'viewportTop'
>> set player.y to viewportTop
> Player1.X < 'viewportLeft'
>> set player.y to viewportLeft
> Player1.X > 'viewportRight'
>> set player.X to viewportRight
** edit, You might want to add +/- pixels to each set X/Y, so that it stays inside the viewport and not halfway out.. ie, if your player is 100 pixels wide then set player.X to "viewportRight+50" etc.
hope it helps
Develop games in your browser. Powerful, performant & highly capable.
Awesome! I'll try it tonight. Thank you.