 |

 About object properties

You learned to set the properties of brushes in the map editor.
These are the initial values for the properties, when a new game begins.
Now you will see how you can change them during gameplay.

First, we have to bulid a small scene to work with.
Start from the default template data and add Theo wizard as an action object (tile=202, id=1000, type=dynamic, class=action)
and Poggie as a dynamic brush (tile=177, id=1001, type=dynamic, class=none).
Place Theo at 592,216 and Poggie at 688,240. Save the map.
|
|
Here are the defines that can be used to access the properties of dynamic brushes.
O_LAYER,
O_X,
O_Y,
O_W,
O_H,
O_TILE,
O_FRAME,
O_MAP,
O_FLIP,
O_COLOR,
O_SHADER,
O_SCALE,
O_ID,
O_MATERIAL,
O_DRAW,
O_DISABLE,
O_DELAY,
O_ANIM,
O_COLLIDER,
O_CLASS,
O_STATUS,
O_TARGET,
O_DEATH,
O_COLLISION,
O_USER
|
 Basic properties
We're going to make Theo work some magic on little Poggie.
Add the following ActionObject callback in the game.gs file, as usual.
Run the game, press action on Theo and see the results.
Now, upside down...
A miraculous change...
And a little coloring...
And finaly, a little growing...
 Logic properties
To hide Poggie you can either set the O_DRAW property to 0,
or even better, you can set the O_DISABLE to 1.
If the draw property is used, Poggie will just be invisible, but you will be able to interact with him.
If disabled, Poggie will be both invisible and inactive.
The animation delay can slow the things down.
|
|
All properties of dynamic brushes are stored in the .sav file when the game is saved.
They are set back when the game is loaded. So you can change them anytime and don't worry about them.
The type and the id properties must not be altered, because they can mess some internal order in the engine.
All other properties can be changed any time, if the given values are valid.
|
Homework
Play a little with these properties and make sure you understand them well.

To learn more details, see the reference chapters about objects.
Engine exported objects properties and functions.
|
 |
|