Hi gus ,i make a DefenseTower Game,i found some problem now?

my class relation is:

when i coding Gamelogic & UIControler ,i found that ,On UILayer if a monster ui should do some action, this ui should be bind its database. if this UI don’t care the database,
so on GameLogicLayer the database should tell UILayer which UI go to work. Now I give a static Number for database and UI , database and UI have the same Number,but the number never be the same for other UI&database. ok, UI can find his database. I think my design is not good,but i don’t know better than it . I need some help ,tell some better way for it. I don’t like my design very much.please give me some ideas.
thank you gus!

I think about NotificationCeter,it cost too much on messageLoop…

I don’t understand your post. Are you using Cocos2d-x or Cocos2d-iphone?

cocos2d-x & c++

U don’t know my question or anything?

I’m sorry, when I read what you wrote I don’t follow it.

I can say that what I do is I make some things global singletons so I can access them without so large of a hierarchy.

UIcontroler is global singletons ,GameLogic is global singletons, but the monster,tower,bullet can’t be global singletons,it is too much.
i need the better way for monster data connect its UI

I use a character manager class for this type of stuff. Take a look at some design patterns for help: http://gameprogrammingpatterns.com/contents.html

oh,thank you ~

不客气!:slight_smile: :slight_smile:

。。。。。 666666666的很