How do I constrain sprite to view ?

Get help using Construct 2

Post » Mon Apr 10, 2017 5:52 am

Hi guys, I have tried so many things....but I think the secret is some how clamp to view....but Iam simply not able to manage that. this is the file:
https://lookaside.fbsbx.com/file/target ... JOkMIZAsjA

The problem is this... my red target should stop when It goes out of the screen, so that it is always on screen...but if I fly to much to the right border ( this is a problem for all 4 sides since the target can be rotated with gamepad stick) the red target is not visible. . please help :)

thanks
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Thu Apr 13, 2017 4:17 pm

You should be able to use either "Bounded Scolling" or just write a custom event to move the red_target back inside the view whenever it exceeds your visible boundaries.

Something like:

if red_target.x > boundary.x : red_target : move to : boundary.x
if red_target.y > boundary.y : red_target : move to : boundary.y
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Sat Apr 15, 2017 1:34 pm

thanks :)
B
37
S
16
G
2
Posts: 451
Reputation: 4,873


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests