Trying to center sprites

Get help using Construct 2

Post » Wed Mar 27, 2013 5:05 pm

Hey everyone! I am trying to center my paddle and ball on the start of every layout. This works with the events below.

Paddle > Set X to WindowWidth / 2
Ball   > Set X to WindowWidth / 2

But for some reason when I am testing the game, over WIFI preview, and on my Android device, the ball/paddle is set to about 1/4 of the WindowWidth from the left.

My first thought was that I was using WindowWidth / 2 twice. That would equal the 1/4 I am seeing now. But I looked through everything and that just isn't possible.

Any advice?

Tekniko2013-03-27 17:19:07
B
50
S
14
G
12
Posts: 813
Reputation: 16,764

Post » Wed Mar 27, 2013 11:51 pm

Have you tried setting X to " viewportRight(0)/2 "? The "0" indicates the layer in which you placed the paddle or the ball.

So it would look like this:

Paddle > Set X to viewportRight(0) / 2
Ball   > Set X to viewportRight(0) / 2

Also try to go for the "greater than, or equal to sign". It looks kinda like this----> ">/"retrodude2013-03-27 23:54:48
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Thu Mar 28, 2013 1:12 am

Ahhh, thank you so much. That fixed it!
B
50
S
14
G
12
Posts: 813
Reputation: 16,764


Return to How do I....?

Who is online

Users browsing this forum: Vodakman and 20 guests