0 Favourites

How do I detect edge of screen?

  • Hi all,

    is there a way to determine if my character is on the left or right edge of the visible screen? I want to limit his movement based on the screen device. I dont want the character to go off the screen since there is no scroll on him. Something like bound by screen would be ideal

  • Hi all,

    is there a way to determine if my character is on the left or right edge of the visible screen? I want to limit his movement based on the screen device. I dont want the character to go off the screen since there is no scroll on him. Something like bound by screen would be ideal

    there is a behavior https://www.scirra.com/manual/89/bound-to-layout

    if you want to use another way, you can make 4 invisible wall and set x,y, and use:

    ViewportBottom(layer)

    ViewportLeft(layer)

    ViewportRight(layer)

    ViewportTop(layer)

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • > Hi all,

    >

    > is there a way to determine if my character is on the left or right edge of the visible screen? I want to limit his movement based on the screen device. I dont want the character to go off the screen since there is no scroll on him. Something like bound by screen would be ideal

    >

    there is a behavior https://www.scirra.com/manual/89/bound-to-layout

    if you want to use another way, you can make 4 invisible wall and set x,y, and use:

    ViewportBottom(layer)

    ViewportLeft(layer)

    ViewportRight(layer)

    ViewportTop(layer)

    Bound to layout would be ideal but since there is no scrolling on my main character, it ends like this: my character leaves screen and then game over. The invisible wall could work. Also i thought about restrict his x y movements but on different screen sizes/aspects the character could not reach the edge of screen or go beyond it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)