Jump to content
  • Advertisement
Sign in to follow this  

Declaring a map object

This topic is 4297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to declare an object (ball) so that either team can pick up the ball. I am modding existing code and I am stuck. If you look at the code below you will see that there are 2 balls one for each team. I want there to be only 1 ball that both teams use. I do not know how to declare it since it is declared by which team the ball is for. Any help would be great. If more code is needed let me know here is the header info:
class RB_RBTeam : public RB_Team
   void onBeginRound();
   void setDroppedController(RB_ItemControllerAPI & icapi);
   bool updateTrackedballs();
   void releaseControllers();
   void makeballAvailable();
   bool availableball();
   RB_MenuPageAPI& getballIndicatorPage();
   std::string             ball_name;
   std::string             enemy_ball_name;
   std::string             endzone_name;
   std::string             enemy_endzone_name;
   bool                    track_dropped_controller;
   RB_ItemControllerAPI  ball_controller;
   RB_ItemControllerAPI  dropped_ball_controller;
here is the .cpp file info:
   shortID = "RB";
   // create the two teams
   _teams[0] = new RB_RBTeam;
   _teams[1] = new RB_RBTeam;
   getTeam(1)->team_name=TEAM_NAMES[0];     // Definable?


Share this post

Link to post
Share on other sites
Another option is to have a static ball object. This way there is only one instance of object when it's referenced by other objects.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!