How do I know when a sprites touches the layout border ?

Get help using Construct 2

Post » Wed Feb 04, 2015 7:58 pm

Hi !

I made a sprite which have the bound to layout behavior.

I would like to know when it touches the layout border.

Any idea how to do that ?
B
12
S
7
G
7
Posts: 448
Reputation: 4,272

Post » Wed Feb 04, 2015 8:06 pm

one way is to put some invincible sprites to the layout corners and check for collisions
another way is to calculate the layoutwidth-layoutheight and the objects X so if the sprite for example comes near the last pixel of the layout you fire the event
Image
B
25
S
9
G
2
Posts: 139
Reputation: 3,024

Post » Wed Feb 04, 2015 10:45 pm

The first one is more reliable if my sprite have a complex hitbox. Thank you !
B
12
S
7
G
7
Posts: 448
Reputation: 4,272


Return to How do I....?

Who is online

Users browsing this forum: JoshSenpai, tetuan, Yahoo [Bot] and 11 guests