Step 3

Creating Food variable!


In this step we are going to create our first variable! Lets label it Taco

Variables are the names we call information we store in memory.

It is like a container or box that we put a label on, the computer can then store millions of containers(variables) and call or change when we need them.

Set the foods sprite and type


Now we will need to select the art for our food and select what type of object it will be.

A variables type will determine how it interacts with other objects in the game.

Set the foods postion!


The next step it to set the position of our food.

Positions in a 2D game like this use coordinates called x and y. These are pixel counts from top to bottom and left to right

We are taking it a step further and making the potion of our food to be somewhere random on the screen. We have determined the max values for x to be 0 to 160 and y to be 0 to 120.