Cosmic R

Members
  • Content count

    102
  • Joined

  • Last visited

Community Reputation

159 Neutral

About Cosmic R

  • Rank
    Member
  1. Structuring and organising classes

    thanks for the great reply.  I have taken into account your suggestions. My biggest problems as you noted appear to be numbers 2, 3 and 5. Basically my game should know when the player has fired etc, not have the player class tell it. I was delegating too much down the chain. All my state classes should do is update the object it's attached to.   As far as my sprites go, yeah I need to re-write it - at the moment it works, but not how it should so I'm aware of that one...   And with no 1, the singleton, if I shouldn't use it then how do I instantiate the game? A static class?
  2. Hi all, I've been a long time lurker for a few years after a long break from the site.   I'm still a beginner, but am really pushing to get a few games under my belt.   Anyway, I've set up a basic game design like this:   Game class Singleton Game State Class  (for playing/paused etc)  - handle input  - draw  - update   Sprite Class   Game Object Class  - list of sprites for animation  - virtual handle input (calls state->handle_input)  - virtual update (calls state->update)  - virtual draw (calls state->draw)    - Monster Class (derived from GameObject)  - Player Class (derived from GameObject)   State Class  - virtual handle_input  - virtual update  - virtual draw MonsterState Class (derived from State) PlayerState Class (derived from State)   Object Manager Class  - manages a list of game objects of a type eg ObjectManager<Monster> monster_manager;  - calling monster_manager.update() runs the update command on all the monster objects etc   Okay, so now that's out of the way, my problem is how do I get my objects talking to the manager? I want my player object for example to be able to tell the manager to create bullet objects.   But it seems the way I've designed it all only allows for messages to be sent downwards, not upwards. I tried including the calling objectmanager on each update call, but because the objectmanager is templated it didn't work.   I thought of creating a global messaging system, where a list of message objects is kept and every loop they are executed, but that's just moving the problem around, not really changing the structure (ie the message class would need access to the ObjectManager)   Am I going about this the wrong way?   Are there any good examples of basic games (but not Pong) that allow for expansion? Maybe something like object oriented space invaders?
  3. [quote name='tom_mai78101' timestamp='1305467933' post='4811078'] [quote name='BaltazarDZ' timestamp='1305291967' post='4810187'] They are just two lines of equations that don't work magic. There's a bit more of preparations beforehand. Did you read the tutorial from the link I provided? The calculations needed to convert screen coordinates to isometric coordinates are provided in there. [/quote] Yes, I have read the article. No, I think I must've not given the right question. What I meant to say is, when you want to search a math formula and its theory behind it, without having any knowledge to what that math formula is all about prior to searching, what is the trick to searching for these information when using Google? How do come up with the search term that I could easily apply and get the results what I wanted if given a math formula yet there's not much information to be conveyed from? [/quote] the way google works is it's just a big answer machine. for example, say I've got my isometric tile engine working, but I don't know how to make tiles selectable by mouse: [url="http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=how+to+get+mouse+position+in+isometric+map"]how to get mouse position in isometric map[/url] and I get loads of results with the answer. now say I want to go back to basics and get the theory behind isometrics. All I know is its a view called isometric- [url="http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=how+to+get+mouse+position+in+isometric+map#sclient=psy&hl=en&biw=1261&bih=756&source=hp&q=isometric+view&aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=c8eeb2db0605debf"]isometric view[/url] the first result is a wikipedia article - with loads of background on the theory - h[url="http://en.wikipedia.org/wiki/Isometric_projection"]ttp://en.wikipedia.org/wiki/Isometric_projection[/url] it all really snowballs from there. even if you only have the vaguest clue about a topic you can google it. you just have to have the patience.
  4. anticracking technique help?

    obfuscation?
  5. Loading bitmaps in Allegro

    http://www.allegro.cc/manual/api/loading-image-files/load_bitmap doesnt say anywhere anything about supporting jpg.
  6. NPC Voices

    its as simple as if it were possible we would have seen it already.
  7. Good calculator for programmers?

    the calc that comes with ubuntu suits me. its got leading zeros and digit grouping, and it can do much more that windows calc, such as square root without having to use the x^y button.
  8. class prototypes

    Quote:Original post by Storyyeller I was going to do it that way, but it wasn't working, so I tried moving everything into the header to see if that would help. I figured I could always change it back once I got it working. its not plainly obvious to me, but I suspect that this is where your problem is.
  9. class prototypes

    also try to avoid putting full function definitions inside your header files. its much more logical to only put your prototypes there, and the definitions in the .cpp file. This lets you organise your code easier and also avoids having to recompile every file each time you make a change.
  10. Allegro problem

    nah it will work the way it is. trust me the problem is with the bitmap filename. either the file is in the wrong folder, or there's a typo in the name. I'm pretty sure there's no problem with long filename support anymore.
  11. class prototypes

    your header files contain the prototypes for your functions and classes. its like telling other functions, 'these classes exist, but I have described them elsewhere' a prototype looks like this (say, foo.h):class Foo { Foo(); //constructor ~Foo(); //destructor int Bar(); // a function that returns int }; then you would make foo.cpp might look like this:Foo::Foo() { cout << "Hello World!"; } Foo::~Foo() { cout << "all done!"; } Foo::Bar() { int value; cout << "enter a value"; cin >> value; return value; } and then finally, you would put #include "foo.h" in your main.cpp file. [Edited by - Cosmic R on February 23, 2009 6:40:00 PM]
  12. Allegro problem

    END_OF_MAIN() is an allegro macro, dont comment it out! put in something like if (!good_guy_sprite) { allegro_message("unable to load bitmap"); exit(1); } this will let you see if its finding the bitmap. I recommend using a shorter filename and without spaces to avoid more confusion too.
  13. Problems Exiting Program

    probably a good idea to rename the exit variable to something else too, to avoid confusion with the exit() function.
  14. Problems Exiting Program

    you shouldnt need to but try allegro_exit()
  15. yet another pointer question

    Quote:Original post by scratt Why not create a std::vector or std::list of std::strings and just truncate them when you put them into the list. because I like to be difficult! hehe nah just joking. well, almost. because I'm using C, not C++ and also because I want to understand the problem better.