JoBase Lessons Demos Games Reference Download
Back Next

Drawing Things

Now it's time to draw some shapes! Let's start with a simple rectangle.

You should now see a default black square on the screen. We can turn it into a rectangle by changing its size.

We can also put it in a different place.

As you can see, the code is getting a bit long. We can shorten it by getting rid of the keyword labels.

Remember that when removing the labels, you need to keep the attributes in the right order. You must define rectangle attributes in the order of x, y, width, height, angle and color. Now we can rotate our rectangle with the angle attribute.

Let's add a circle.

This will draw a circle in the middle of the screen. Like before we can position our circle and remove the labels. Cirle attributes must be defined in the order of x, y, diameter and color.

Finally, let's create our own custom shape. We can do this by defining the coordinates for its corners.

As we defined three corners, this makes a blue triangle in the middle of the screen. The great thing about custom shapes is that you can make them as complex as you like.

Now you can draw things in JoBase! Experiment with different combinations and add them to your next game.

Back Next