On-Screen/Within viewport system expression?

Get help using Construct 2

Post » Sat Jan 28, 2017 8:27 pm

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?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sat Jan 28, 2017 8:38 pm

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.
Image Image Image
B
29
S
11
G
27
Posts: 735
Reputation: 17,012

Post » Sat Jan 28, 2017 10:12 pm

MPPlantOfficial wrote: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 :?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sun Jan 29, 2017 5:20 am

Zebbi wrote: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.
Image Image Image
B
29
S
11
G
27
Posts: 735
Reputation: 17,012


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, OBLIVION and 25 guests