> For the complete documentation index, see [llms.txt](https://learn.pakronics.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.pakronics.com.au/halocode-1/code-with-mu-a-simple-python-editor/examples/level-up/use-global-variable-to-interact-with-sprites.md).

# Use Global Variable to Interact with Sprites

**Programming result**

When you rotate HaloCode around the y-axis, the sun on stage will rotate as well.

**Introduction to HaloCode's Axes**

The axes of HaloCode are as follows:

![](/files/-LpgAGxhEgyiKrMmad7z)

**Create a new variable**

1\. Click Variables category, and then click "Make a Variable". Name the variable "y".

![](/files/-LpgAGxirJ31YTyx-fQ6)

2\. Add a Variables block set (y) to () and a Sensing block rotation angle around (). Choose "Y" axis.

![](/files/-LpgAGxj2zM9rLn7-kw2)

**Add event and control**

3\. Add an Events block when button is pressed and a Control block forever.

![](/files/-LpgAGxkOeRiZf3bnAqF)

**Add a sprite**

4\. Under "Sprites", click "+". Choose "Sun1".

![](/files/-LpgAGxl1RDwHAK5acAo)

5\. Delete default sprite "Panda".

![](/files/-LpgAGxmm3nK7R3pUCXW)

**Program the sun**

6\. Add a Motion block turn ↷ () degrees and a Variables block y.

![](/files/-LpgAGxnmhG8DS6R2Ncj)

7\. Add an Events block when green flag clicked and a Control block forever.

![](/files/-LpgAGxouJZP9ZnBhznW)

8\. Rotate HaloCode and see what happens.
