Original Post
To describe my Problem I have to expand a little:
I wrote a game all of whose Objects(Timers,Inventory-Itemens, Walls, Trees...) are classes based on a subclass calleg gobject.
The classes which are direct in the world(Trees, Players, Walls) are also based on a class called wobject which is based on gobject.
always when an Object is created it gets automaticly added to a huge array of gobject pointers.
The trick here is, that that even the most unimportant object has a virtual handle function, which is called on a big loop, that calls every handle for each pointer in the array.
For example if the Player has an Item in his inventory, that automaticly heals him, I can write this in the virtual function of the class autopotion.
but the Problem is, for example in the collision detection, I have to acess Attributes like height, width and position.
How can I acess this attributes form the Pointer-Array?
I wrote a game all of whose Objects(Timers,Inventory-Itemens, Walls, Trees...) are classes based on a subclass calleg gobject.
The classes which are direct in the world(Trees, Players, Walls) are also based on a class called wobject which is based on gobject.
always when an Object is created it gets automaticly added to a huge array of gobject pointers.
The trick here is, that that even the most unimportant object has a virtual handle function, which is called on a big loop, that calls every handle for each pointer in the array.
For example if the Player has an Item in his inventory, that automaticly heals him, I can write this in the virtual function of the class autopotion.
but the Problem is, for example in the collision detection, I have to acess Attributes like height, width and position.
How can I acess this attributes form the Pointer-Array?