Monster in Tile Based RPGs

Started by
0 comments, last by PsYchOtroW 23 years, 5 months ago
Hi, i have some probs with the monsters in my Tile Based RPG. My Object class looks like this: class cObject { public: cObject( ); virtual ~cObject( ); int LoadMap( char *path ); int Draw( ); int Create( ); int GetMaxX( ); int GetMaxY( ); int GetContent( int x, int y ); int objX; int objY; int Collision( ); private: int zeilen; int spalten; // ifstream Datei; // char *plan; int* plan; FILE* datei; int index; int index_x, index_y; // looping vars int start_map_x,start_map_y, // map positions end_map_x,end_map_y; int offset_x, offset_y; // pixel offsets within cell }; extern cObject obj; It loads the objects from a file. And Draws it. So now i don`t know how i can implement monsters. Does anyone have some examples or links for tutorials? Thanks Lutz Hören
psYchOtroW
Advertisement
Just a guess, but perhaps a MoveTo function. Thats a pretty basic feature of a monster. Well, some don''t move, but most do. That will require a pathfinding algorithm. You could also do a RunTo. Then you could add an Attack function, which might require a SelectWeapon function and depending upon the weapon might require Moving To the player. You most likely want some type of event loop like with windows. The monster basically stands there doing nothing until an event such as the player moving within a certain distance occurs. Then he becomes active and gets update messages so he can move, attack, run for help, etc. Other events occur like being attacked, taking damage, etc.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement