# How to make x and y varables

**URL:** <https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581>\
**Category:** Help\
**Tags:** game\
**Created:** [October 1, 2025, 11:13pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581 "2025-10-01T23:13:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LebronJames](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@LebronJames](https://forum.makecode.com/u/LebronJames)\
**Post date:** [October 1, 2025, 11:13pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581/1 "2025-10-01T23:13:47Z")

</div>

I just found this and Im used to scratch code so I was wondering how do I make x and y varables to make it more simple for my character movements.

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [October 2, 2025, 9:38pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581/2 "2025-10-02T21:38:52Z")

</div>

Welcome to the Makecode forums! When you create sprites using the built in sprite stuff, they already have x and y variables assigned to them, as well as a bunch of other stuff:

 ![Screenshot 2025-10-02 at 1.13.56 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/7/b742a9528ffc7e82006949c921dc7c5ba0906032.png)  
All that stuff is near the top of the Sprites block tab! :)

---

<div class="post-metadata">

**Author:** ![Dlee](https://avatars.discourse-cdn.com/v4/letter/d/d6d6ee/32.png) [@Dlee](https://forum.makecode.com/u/Dlee)\
**Post date:** [October 2, 2025, 9:38pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581/3 "2025-10-02T21:38:57Z")

</div>

One way to x and y variables that I know is, going to the Variables tab and creating two variables. Then, name the variables “x dir” and “y dir” then you can controller projectiles based on the way you are facing in your game I will send one of my games where I did this for more information .

> **[Battle Ground](https://arcade.makecode.com/S41508-64871-75584-45821)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![ItzWolfeel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/itzwolfeel/32/25239_2.png) [@ItzWolfeel](https://forum.makecode.com/u/ItzWolfeel)\
**Post date:** [October 2, 2025, 9:42pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581/4 "2025-10-02T21:42:38Z")

</div>

Not sure what you wan’t, but in sprite you should see stuff to set y/x velocity and such. You may be able to take the x and y variables out of the blocks in the sprite area.

---

<div class="post-metadata">

**Author:** ![LebronJames](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@LebronJames](https://forum.makecode.com/u/LebronJames)\
**Post date:** [October 3, 2025, 5:08pm UTC](https://forum.makecode.com/t/how-to-make-x-and-y-varables/39581/5 "2025-10-03T17:08:17Z")

</div>

oh thank you guys so much
