Group of Objects
Author: | Mårten
|
Submitted: | 23rd July, 2002
|
Views: | 4981
| Rated: |
|
|
This is one of the first features I ran in to when I began using TGF, but I still haven't started to use it. A shame as it really lightens up the code and I'm sure some of you are more clever by using it, but I want to present this to those who aren't just to show the vast possibilities of it.
The group of objects or the object qualifier let's you assign events to many objects at once. It's pretty selfexplainatory as a group of objects is treated in the event editor just like the objects of which it's made up of. To use them; right click an active object, choose object preferences and press the Add button below the Object qualifiers window.
Here are a couple of examples of use to get you (and me) started:
*More enemies, less code
When having many different enemies in a game you can assign all the enemies to one group of objects, the Group.Bad for example. Now, instead of having collision with player events for each of your enemies you simply use the Group.Bad as the active enemy object to assign these events to every enemy included in the group. If you have many different weapons the collision events between bullets and enemies can also be reduced by using the group of objects. And while we're on the bullets issue; why not assign bullets that take the same amount of damage to the same group.
*Player character change
Let's say you're making a game where the player may choose from many different characters. If you let all the character active objects belong to the same group you can share the events that all the characters can be part of by using the group icon as an active object while the unique moves for every character uses it's own event aside from the group's events.
More examples of group use can be found in the game Zeb.
Finally, here's what TGF help says about the issue:
"The Object Groups tab links a number of different objects into a single category. Each group can now be tested directly for an event, just as if it were a single object.
You can use these groups to assign a range of actions to a collection of objects. For example, deal with all your attackers using a single set of events or manage your titles with another.
Groups can be created for Active Objects, Text Objects, Questions, and Counters. However, each group can only be used by a single object type at a time. You cannot assign a Counter object and an Active Object to the same group. If you try, your new selection will be ignored."
|
|
Mårten
Registered 25/06/2002
Points 769
|