On-Screen/Within viewport system expression?

0 favourites
  • 4 posts
From the Asset Store
Add this awesome sound effects to make your visual novel come to life!
  • Is there a way of testing if the X and the Y of something is "on-screen" but with a system expression? I think it's something do with dividing the width by the height or something?

  • If (OBJECT.X - OBJECT.Width/2) + MIN_VIEW > 0 |

    or

    If (OBJECT.X + OBJECT.Width/2) - MIN_VIEW < WindowWidth |

    If (OBJECT.Y - OBJECT.Height/2) + MIN_VIEW > 0 |

    or

    If (OBJECT.Y + OBJECT.Height/2) - MIN_VIEW < WindowWidth |

    where MIN_VIEW is the minimum amount of Pixels you want inside the window.

    Note: This is untested so try it yourself first and tell me how it goes.

  • If (OBJECT.X - OBJECT.Width/2) + MIN_VIEW > 0 |

    or

    If (OBJECT.X + OBJECT.Width/2) - MIN_VIEW < WindowWidth |

    If (OBJECT.Y - OBJECT.Height/2) + MIN_VIEW > 0 |

    or

    If (OBJECT.Y + OBJECT.Height/2) - MIN_VIEW < WindowWidth |

    where MIN_VIEW is the minimum amount of Pixels you want inside the window.

    Note: This is untested so try it yourself first and tell me how it goes.

    Just trying to think how to tie those four conditions into two OR blocks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just trying to think how to tie those four conditions into two OR blocks

    It's two events actually. One 'or' block for the vertical axis, another for the horizontal.

    I'll be making a capx when I have the time.

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