I am making a vertical shooter game, the movement is caused by the mouse clicks. I need a way to keep the player from moving too far up on the screen. Bullets and enemies need to be able to pass through the barrier but the player cannot be able to. Any suggestions?
The behavior bound to layout.
That is not what I need. The layout is bigger than what I need the area of movement to be. I just need to have an area that the player cannot leave near the bottom of the screen. But I still need bullets and enemies to be able to pass through it. And also another quick question, how do I make backgrounds invisible on Gimp editor??? Thanks!
Using the Clamp() expression would work well in this situation.
Clamp takes 3 parameters like this: Clamp(value, min, max).
With a window size of 640x480 and no scrolling you can restrict the player to the bottom half of the screen with this:
--player| set X to Clamp(player.X, 0, 640)
--player| set Y to Clamp(player.Y, 240, 480)
With scrolling change it to this:
--player| set X to clamp(Mouse.X-ScrollX, -320,320)+ScrollX
--player| set Y to clamp(Mouse.Y-ScrollY, 0,240)+ScrollY
Develop games in your browser. Powerful, performant & highly capable.