# Out of Bounds

Get help using Construct 2

### » Wed Feb 29, 2012 12:36 am

So I'm trying to figure out what your expression means:

X Position: You limited the object's horizontal movement or position on the x-axis to a minimum of half of the object's width and a maximum of the layout's width subtracting half of the object's width.

Min: Half of object's width = 38
Max: Layout's width (640) - 38 = 602

The object's movement is limited to a minimum of 38 and a maximum of 602 on the x-axis?

Sorry if I don't really understand. ;XTokki2012-02-29 00:46:26
B
13
S
4
G
6
Posts: 16
Reputation: 3,527

### » Wed Feb 29, 2012 12:52 am

'cause the image point is at the center of the sprite. If I don't offset things by half the width and half the height you will have half the sprite out of layout. But maybe it's not a problem for you (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,336

### » Wed Feb 29, 2012 12:57 am

Ooh, the image point is taken into consideration in the expression as well.

So if it was on a grid, the object can only move between those two values?

(I'm a super noob, so I need the dumbed-down explanation. *blushes*)
B
13
S
4
G
6
Posts: 16
Reputation: 3,527

### » Wed Feb 29, 2012 12:57 am

Since the origin of your image (its x and y coordinates) is centered, if you add or remove half of its width to its x coordinate you get the coordinate of the left/right border of the object.
This way, staying in the range (38, 602), you are sure that your image sticks to the boundaries of the screen horizontaly.
Same logic verticaly.
New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
243
S
85
G
39
Posts: 6,932
Reputation: 56,898

### » Wed Feb 29, 2012 1:04 am

;O I think I get it! Thanks for the explanations!

Sorry if it seems like I'm harrassing the forum with my noob questions. Hehe.
B
13
S
4
G
6
Posts: 16
Reputation: 3,527

Previous