Game Development Community

Gui accessing player variables

by Ricardo Cabral · in Torque Game Engine · 02/14/2005 (7:14 am) · 3 replies

Hey there,
i was wondering if it's possible to have a gui element to have access to player coordinates, because i needed to have a graphic that should be rendered in a dynamic position in the screen, according to the player's head position relative to body. i thought a good idea to implement this was to subclass GuiBitmapCtrl, but i need to access the player's mHead and mBody variables. how could this be done?


thanks
-nd

#1
02/14/2005 (12:55 pm)
Those aren't public variables, and making them public is a Bad Thing To Do. You'd better add some public functions to the player class that return those variables for you.
#2
02/16/2005 (2:26 pm)
Problem is, how do i make sure im getting the members of the right player instance (the client)?
#3
02/18/2005 (12:24 pm)
It would be a good idea to check out game/vehicles/guiSpeedometer.cc.

That is an example of a gui element that looks into another object (the vehicle in this case) to extract data.