# Sprite position glitch

**URL:** <https://forum.makecode.com/t/sprite-position-glitch/4042>\
**Category:** Help\
**Created:** [October 23, 2020, 3:50pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042 "2020-10-23T15:50:30Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [October 23, 2020, 3:50pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/1 "2020-10-23T15:50:30Z")

</div>

So… I am currently coding Among us and I found a glitch and need help to fix it! It is a sprite position glitch that is very wierd… I set the position of the start player (The screen where yo see the role and there is 1 imposter among us) to where I want it to be… well it now randomly chooses its position… on the top, on he bottom, left, right and not in screen…  
Any ideas on how to fix that? Also if I remove the set sprite position it still spawns randomly…  
Centering the camera also does not work! (The code for it is now in a function)  
(Yes my code is a mess) Thanks!!!  
(PLS DO NOT SAY IT IS YOURS)  
BY DAHBIX

Older Version:

> **[Among Us AI mmmmmm](https://arcade.makecode.com/50943-54785-72342-85224)**
>
> Erstellt mit ❤️ in Microsoft MakeCode Arcade.

Newest Version:  
Glitch still there …  
Some fixes and detail work on the map  
And 2 Functions (Imposter and Crewmate (to make it less of a mess!))

> **[Among Us AI dtl-3](https://arcade.makecode.com/47229-86544-11712-39477)**
>
> Erstellt mit ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 23, 2020, 4:25pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/2 "2020-10-23T16:25:10Z")

</div>

I absolutely love the sprites!

I don’t understand your question. What is the problem? This?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1bc13472ba2945c7d8a47873ccceb655c960a298.png)

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [October 23, 2020, 4:46pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/3 "2020-10-23T16:46:59Z")

</div>

Wow! I absolutely love this so far! Let me look into the code and see what I can do.

---

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [October 23, 2020, 4:59pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/5 "2020-10-23T16:59:30Z")

</div>

Exactly… The sprite just spawns in a random Position… Of course that should Not Happen…  
Thanks for your quick help

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 23, 2020, 5:03pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/6 "2020-10-23T17:03:50Z")

</div>

I’m gonna guess that this is also the problem:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/3a44f4131b38a4a287e4145137a4dee54ae62cd4.png)

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 23, 2020, 5:06pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/7 "2020-10-23T17:06:44Z")

</div>

Okay, here:

> **[Among Us AI mmmmmm](https://arcade.makecode.com/49523-58334-98304-50598)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I’m guessing the problem was that the dialog was popping up before the `Start_Player` sprite, therefore preventing it from moving. So I added a `pause 10 ms` block, which forces Arcade to update the screen before drawing the dialog.

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [October 23, 2020, 5:23pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/8 "2020-10-23T17:23:25Z")

</div>

I tried out your link and it is still spawning randomly. This seems so hard for something so simple 😜 I’ve tried making them relative to camera, fly to center of screen, place on top of tilemap center. Nothing seems to work. Could the story extension be used for the “queue story part” blocks instead of pause?

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 23, 2020, 5:25pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/9 "2020-10-23T17:25:04Z")

</div>

These are epic designs!

---

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [October 23, 2020, 6:13pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/10 "2020-10-23T18:13:10Z")

</div>

Thanks but it does not work… you probably were lucky so it spawned in the middle … I tried it multiple times… sorry but thanks tho

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [October 23, 2020, 6:15pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/11 "2020-10-23T18:15:23Z")

</div>

I might have an idea. Bear with me for a min

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [October 23, 2020, 6:32pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/12 "2020-10-23T18:32:46Z")

</div>

oop- nevermind

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 23, 2020, 6:36pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/13 "2020-10-23T18:36:13Z")

</div>

I would try increasing the duration.

---

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [October 23, 2020, 6:41pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/14 "2020-10-23T18:41:48Z")

</div>

already tried it wit 100ms… also not working

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 24, 2020, 8:36pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/15 "2020-10-24T20:36:13Z")

</div>

I think you have too much code in the ‘game update every 100’. I think you should only use this if you want check the other players and have them move around. I noticed in the game start, that you set a countdown, allowing the players to move around. You could use a ‘on countdown end’ event (Info section), within that event block display the dialog box call the ‘call CREWMATE’ and ‘call IMPOSTER’ functions. Otherwise you could also set a variable ‘time to start game’ that stores the value (game -\> time since start + some time to wait), and in your game update event, check if that variable is less than ‘game -\> time since start’.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [October 24, 2020, 8:44pm UTC](https://forum.makecode.com/t/sprite-position-glitch/4042/16 "2020-10-24T20:44:47Z")

</div>

Maybe.
