Prevent object of exiting view area

Get help using Construct 2

Post » Tue Jun 06, 2017 7:05 am

In a top-down view
I have a object with 8 directional movement that I am using as aim, so the player will always look for where this sprite is (this is for aiming with the gamepad only).
The player has ScrollTo behavior, and is always in the center of the view. I would prevent the aim sprite to exit the viewport.

Using the window width and height or the player location doesn't seens to fit, and I don't find anything about it, there's a way of doing it?
B
28
S
14
G
6
Posts: 90
Reputation: 5,487

Post » Tue Jun 06, 2017 8:28 am

You can check if the aim sprite is visible on screen( size and position expression), if its not move it a few pixel's back and disable its movement. When its back on the screen enable the 8-movement.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests