**This is an old revision of the document!**

FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

What a shape painter object is

A shape painter object allow us to draw shapes in our game. It can be useful for making simple UI elements or even a selection box for example.

Add a shape painter object

To add a shape painter object we need to select the Shape painter from the list when we add a new object. You may need to scroll down in the list to find it.

Edit properties

Next we want to edit the properties. To do that, right click on the object and select Edit object from the list. It should bring up the object properties window.

Change the colour and opacity

In the properties window we can change the outline colour, the fill colour the opacity of each colour and the outline size of our object to make it appear just the way we need it.

Relative object position

By default the position of the shapes we draw on the screen is relative to the shape painter object.

In case of relative position when we draw the shape on our screen the position 0 on the X and Y axis is going to be the position of the shape painter object so in case we want to draw a shape from position 100 pixels on X and Y it is going to be 100 pixels from the shape painter object wherever it is on the screen. In case we untick the box the position 0 on the X and Y axis is going to be at the top left corner of our scene regardless where the object is located. If it not, it is going to make more sense when we actually start drawing our shapes.

Draw a shape

To draw a shape first we need to add the shape painter object to our scene. If we run the preview now we won't see anything as the object basically just add the functionality and hold our properties. To draw a shape we need to use events. In case you are not familiar with events, I recommend to check out the events page on the wiki.

Let go to the events editor and add an event, then click add action. Next find the events for Primitive drawing. We can choose from 3 different type of shapes to draw. Circle, Line and Rectangle. We are going to draw a rectangle on the screen so let select the Rectangle under drawing

Next, on the right side select the shape painter object we are going to use and for the top left position enter 0 for both X and Y and the bottom right position enter 100 for both X and Y.

No if we launch a preview it will draw a 100 pixels wide and 100 pixels high rectangle on the screen.

If we left the relative position enabled, you may notice our rectangle is in the the same position as the shape painter object even though it origin point is 0. Now if we disable that option and launch the preview again, you going to see our object is drawn in the top left corner of our scene. Using events we can also change any properties of a shape on the fly.

Examples

List of examples coming soon

  • selection box