Archived

This topic is now archived and is closed to further replies.

Galileao

enemy selection

Recommended Posts

yo, Ok. I''mmaking an old SNES style quest game to get into the swing of things. I''ve made an "enemy" base class with several virtual functions that I override with the specific attack functions of each monster, so that I can just access all the monsters with the base pointer, and just use the same battle function. My problem is that I''m not sure how I should create the instance of each monster. What I''ve been thinking about is giving the tiles a number indicating a power level then righting a function that uses a switch statement and a random number generator to select one of the monsters of that level, and then just call that function before each battle.... but it doesn''t quite sound right to me. Not sure what. It seems rather long and what not, which usually means your doin something wrong. So I figured I''d ask you guys since you guys seem to know what your doin.

Share this post


Link to post
Share on other sites
Do a web search for the "object factory" pattern. It''s what you want.



Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites