# Sprite x y coordinates use the centre, not upper left of sprite

**URL:** <https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767>\
**Category:** Canvas / Gaming\
**Created:** [September 3, 2022, 9:39pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767 "2022-09-03T21:39:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristhorsteinssonf4y](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kristhorsteinssonf4y/32/136014_2.png) [@kristhorsteinssonf4y](https://community.thunkable.com/u/kristhorsteinssonf4y)\
**Post date:** [September 3, 2022, 9:39pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/1 "2022-09-03T21:39:35Z")

</div>

Hi,  
When I set the x, y coordinates of the sprites on the canvas they locate as if the x, y was the centre of the sprite, not the upper left corner. All my sprite are offset up and to the left from the intended locations. To test this I created a 50 x 50 px dot at 0, 0 on the 300 x 225 px canvas. See screenshot. Which is the correct definition of x & y sprite properties?  
Thx!  
 ![Screen Shot 2022-09-03 at 3.27.21 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/7/b7d8012ba65108f61512fed66c3bd5dbb83e21db.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 4, 2022, 3:18pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/2 "2022-09-04T15:18:40Z")

</div>

As far as I remember, this has always been the case.

---

<div class="post-metadata">

**Author:** ![kristhorsteinssonf4y](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kristhorsteinssonf4y/32/136014_2.png) [@kristhorsteinssonf4y](https://community.thunkable.com/u/kristhorsteinssonf4y)\
**Post date:** [September 4, 2022, 4:31pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/3 "2022-09-04T16:31:41Z")

</div>

Maybe I’ve been reading the description wrong. I think Swift uses the centre of the imagesprite, while AI2 uses the top / left corner for 0, 0. I interpreted the Thunkable documentation like the latter. Screenshot from Thunkable Docs:

 ![Screen Shot 2022-09-04 at 10.40.44 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/5/350e96517a186d9995d89261a05366aa36713520.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 4, 2022, 4:44pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/4 "2022-09-04T16:44:08Z")

</div>

See this old post talking about the same issue. I know what is written in the docs is not the same but this post will reconfirm my point.

> [@Sprite positioning when canvas loads](https://community.thunkable.com/t/sprite-positioning-when-canvas-loads/1327554/4):
>
> Sprites use the midpoint for coords. If you try to put them half off the canvas, strange things happen.

---

<div class="post-metadata">

**Author:** ![kristhorsteinssonf4y](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kristhorsteinssonf4y/32/136014_2.png) [@kristhorsteinssonf4y](https://community.thunkable.com/u/kristhorsteinssonf4y)\
**Post date:** [September 4, 2022, 4:54pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/5 "2022-09-04T16:54:53Z")

</div>

Thanks, I’ll convert my sprite location coordinates to the midpoint.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [September 4, 2022, 5:41pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/6 "2022-09-04T17:41:46Z")

</div>

Is this a platform specific issue? Do you see the same behavior on iOS that you do on android? I feel like I’ve used it on iOS in this wasn’t the case but it’s been quite some time

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 4, 2022, 6:17pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/7 "2022-09-04T18:17:25Z")

</div>

> [@jared](#):
>
> Do you see the same behavior on iOS that you do on android?

I use Android but at that time when we discussed this issue I am certain that both @tatiang and @catsarisky were using iPhones.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [December 3, 2022, 6:18pm UTC](https://community.thunkable.com/t/sprite-x-y-coordinates-use-the-centre-not-upper-left-of-sprite/2026767/8 "2022-12-03T18:18:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
