Game object

This page is about the class in the source code. For a list of objects available in the game, see Objects.

This article contains content that is outdated. It might describe an obsolete concept or a concept that was implemented in a different way.

A diagram illustrating the planned design for the GameObjects

GameObject is a base class in the SuperTux source code. It is the most basic class for objects in the game. Nearly everything should inherit from this class, for instance badguys, unstable tiles and trampolines. All GameObjects are stored in a list by the engine.
This list will be traversed twice per frame. First the action function is called on each object, and then the draw function of each object is called.

The class also contains a flag that indicates if the object should be removed at the end of the frame. You can call ->remove_me() to set this flag.

Contents

Derived classes

InteractiveObject

These are objects you can interact with. The objects will have an area in the world. And you can send interaction events to them. Typical interaction events will be activate/push, ~EnterArea/touch, ~LeaveArea, hit with object

MovingObject

This class provides a position and functions for collision detection. All Moving objects are held in a separate list by the engine which is also traveled once (between action and draw calls) for collision detection.