Creating enemies in a 2d game

Posts: 116
Joined: 2002.04
Post: #1
You need to be a lot more specific about what you're trying to do.

In general, there will be some kind of data structure that will hold information about all the players in the game, whether friendly or enemy.

It could be something as simple as:

struct playerStruct
    int   class;
    int   type;
    int   hitpoints;
    int   strength;
    int   dexterity;
If you can give more specifics about what you're trying to accomplish, perhaps someone can help.

Quote this message in a reply
Post: #2
Hey, I'll help you out a bit if you'd like. I don't have loads of time on my hands, but I'm always open to code anything Smile

Let me know if you want some extra help!


Graham Wihlidal
Software Engineer
Chronostorm Entertainment
Quote this message in a reply
Post: #3
Ok, I've got the graphics part of my 2D rpg engine finished. Now I'm trying to create a good system for dealing with enemies( a turn-based system, sort of like Exile or Avernum). Now I know that you're supposed to use structs but I havn't found a way to implement this yet. Does anyone know where I can get some good code to help me out with this?
Quote this message in a reply
Jeff Binder
Post: #4
What language are you using? In plain C, use a struct with all of the character's stats, their location, the ID or index of the graphic they use, and any other info.

In Obj-C or C++, you'll definitely want to use a class for characters, items, etc. Then, you keep an array of all the characters in the area class (or whatever you call it). You can loop through them and call their drawing method to draw them, and run their AI method every frame to update their AI. They can have methods for attacking other characters, taking damage, being given items, dropping items, dying and dropping all their items on the ground, etc.

I have a Cocoa based RPG engine that I've been working on for about six months (although recently I've been working on my flight sim instead). It's 3D, but the overall structure may be helpful. I'm probably going to start over with most of it, because there are a few major things I think I should have done differently (the structure of levels makes it too hard to create them, and many resources are only identified by a number instead of a name).

Anyway, since I'm not going to sell it, I probably will release it as open source so other people can get some ideas from it. I have a few things I need to clean up first, and there's no level editor yet (the files are human-readable), but I may be able to release a beta in a few weeks.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  im creating a text base game site DEMILUST 0 3,356 Dec 15, 2008 03:07 PM