Trying to center sprites

0 favourites
  • 3 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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----> ">/"

  • Ahhh, thank you so much. That fixed it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)