• Advertisement

julian boolean

  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About julian boolean

  • Rank
  1. As the McDonald's slogan goes, "I'm lovin' it." Your ideas are great and I'm going to look into it more throughly tonight. Big thanks to everyone for the input, but I'm *always* open for more even though I think this is more then enough. Thanks again. :) EDIT: How would that work with "if (key[KEY_UP])", etc? EDIT AGAIN: I should also mention I'm using this function to draw the frames from a sprite sheet: void drawframe(BITMAP* source, BITMAP* dest, int x, int y, int width, int height, int startx, int starty, int columns, int frame) { int framex = startx + (frame % columns) * width; int framey = starty + (frame / columns) * height; masked_blit(source, dest, framex, framey, width, height); } [Edited by - julian boolean on May 25, 2007 5:23:39 PM]
  2. That seems like an interesting way of doing it, but I don't think it would fit well with the way most of my code is right now. Going to keep looking it over though, thank you. :) Can anyone tell me if the code I posted previously is acceptable for something that's not trivial? If no, then please give me some more input! ;) Edit: On second though, what might your animation class look like? [Edited by - julian boolean on May 24, 2007 8:13:29 PM]
  3. Double post ;) I was referring to getting rid of the switches and having maybe just one function, if thats even possible.
  4. (Using Allegro/C++) cAnimation::cAnimation() { direction = NORTH; curframe = 0; f_count = 0; f_delay = 10; } void cAnimation::animate_cycle() { if (f_count++ > f_delay) { f_count = 0; switch (direction) { case NORTH: { curframe++; if (curframe < 0) curframe = 7; if (curframe > 7) curframe = 0; }break; case EAST: { curframe++; if (curframe < 8) curframe = 15; if (curframe > 15) curframe = 8; }break; case SOUTH: { curframe++; if (curframe < 16) curframe = 23; if (curframe > 23) curframe = 16; }break; case WEST: { curframe++; if (curframe < 24) curframe = 31; if (curframe > 31) curframe = 24; }break; case NORTHWEST: { curframe++; if (curframe < 32) curframe = 39; if (curframe > 39) curframe = 32; }break; case NORTHEAST: { curframe++; if (curframe < 40) curframe = 47; if (curframe > 47) curframe = 40; }break; case SOUTHEAST: { curframe++; if (curframe < 48) curframe = 55; if (curframe > 55) curframe = 48; }break; case SOUTHWEST: { curframe++; if (curframe < 56) curframe = 63; if (curframe > 63) curframe = 56; }break; } } } void cAnimation::animate_half_cycle() { if (f_count++ > f_delay) { f_count = 0; switch (direction) { case NORTH: { curframe++; if (curframe < 0) curframe = 3; if (curframe > 3) curframe = 0; }break; case EAST: { curframe++; if (curframe < 4) curframe = 7; if (curframe > 7) curframe = 4; }break; case SOUTH: { curframe++; if (curframe < 8) curframe = 11; if (curframe > 11) curframe = 8; }break; case WEST: { curframe++; if (curframe < 12) curframe = 15; if (curframe > 15) curframe = 12; }break; case NORTHWEST: { curframe++; if (curframe < 16) curframe = 19; if (curframe > 19) curframe = 16; }break; case NORTHEAST: { curframe++; if (curframe < 20) curframe = 23; if (curframe > 23) curframe = 20; }break; case SOUTHEAST: { curframe++; if (curframe < 24) curframe = 27; if (curframe > 27) curframe = 24; }break; case SOUTHWEST: { curframe++; if (curframe < 28) curframe = 31; if (curframe > 31) curframe = 28; }break; } } } void cAnimation::animate_misc() { if (f_count++ > f_delay) { f_count = 0; switch (direction) { case NORTH: { curframe++; if (curframe < 0) curframe = 3; }break; case EAST: { curframe++; if (curframe < 4) curframe = 7; }break; case SOUTH: { curframe++; if (curframe < 8) curframe = 11; }break; case WEST: { curframe++; if (curframe < 12) curframe = 15; }break; case NORTHWEST: { curframe++; if (curframe < 16) curframe = 19; }break; case NORTHEAST: { curframe++; if (curframe < 20) curframe = 23; }break; case SOUTHEAST: { curframe++; if (curframe < 24) curframe = 27; }break; case SOUTHWEST: { curframe++; if (curframe < 28) curframe = 31; }break; } } } Basically, animate_cycle() would be used for walking or idling, so outside the class I could go: void cPlayer::idle() { draw_action = IDLE; // Drawing is done in a function elsewhere. animate_cycle(); } Then animate_half_cycle() would be used for actions a player can do that doesn't use as many frames, like sitting or swimming. And finally, animate_misc() animates the attack of a player or monster, but it could also be used for other things, like maybe having an animation of drinking a potion or something. Any suggestions on how I could greatly improve this code?
  5. Text input.

    Just wondering how everyone here deals with inputting text to the screen when your using graphics. I was trying to use gstream but it didn't seem to work very well.. Whenever I tried normal output the characters would just flash as if they weren't being buffered properly, then when I tried input, it would just be a black screen until I mashed a bunch of keys then my graphics would show. The characters always went over my mouse too no matter where I put the functions. Before gstream, I was looking at this: http://www.gamedev.net/reference/articles/article2130.asp It seemed to work pretty good, but I was just curious to see other ideas.
  6. Map Manager.

    Hey all! I'm trying to create a manager that will keep track of what area/map the player is in (I'm using C++, Allegro, and a program called Mappy.) Let's just say there are 5 different maps called mTop, mLeft, mMiddle, mRight, and mBottom (they're all classes.) If I was in mMiddle and I went too far left, going off the boundary of that map, then the program would switch over to the mLeft map. At the moment I'm using some code I found while searching a different forum (which works really well for the game states.) I figured it would work for the maps as well since its sorta the same idea. Anyone know if this is a good way to go about doing this? class GameState { public: virtual void Input() = 0; virtual int Logic() = 0; // returns the next state virtual void Draw(BITMAP *) = 0; }; // then come a bunch of classes that implement the above interface ... // the main loop part of the program: void game() { vector<GameState *> states; // fill the states vector with pointers to various game state objects ... GameState *currentState = states[0]; while (true) { // input currentState->Input(); // do logic int next = currentState->Logic(); if (next == EXIT_GAME) { break; } // draw currentState->Draw(buffer); // witch to next state currentState = states[next]; } }(edit) For the game states, I just created a function called buttonCheck to switch back and forth between states. For the maps I was thinking something similar, called boundaryCheck, which would just check to see if the player went off the edge of the map.
  7. my game loop (is it okay?)

    thank you all for the input! :)
  8. (allegro/c++) inside the gameinit case i load the map and graphics and whatever else is needed, i have a seperate initialization function used for more general stuff that i didnt bother including in the example while(mainstate != shutdown) { switch(mainstate) { case login { blah blah blah } case title { blah blah blah } case ingame { switch(gamestate) { case gameinit { blah blah blah } case gamerun { blah blah blah } case gameshutdown { destroy ingame related stuff mainstate = title } } } case mainshutdown { destroy everything else } }
  9. Looking to set up a team of beginners

    contrary to the popular belief, mmo's dont really take thousands and thousands of dollars to make or teams of people. an mmorpg just defines a persistent world that is capable of supporting a large player base. there are tons of one-man mmorpgs out there, bare in mind the majority of them dont have graphics like mainstream ones, but they are still mmorpgs nontheless the thing is to create a one-man mmo you need to do everything yourself, from the graphics to the programming, and to be able to do all that you would need to be more or less, obsessed and put everything before it.. and even then i suspect it would take roughly 2-3 years to complete (not 3d) (edit) you should check out mirage source and learn visual basic or c#
  10. im trying to make it so i can input text to the screen via keyboard.. this is what i have: gstream gs(buffer); int collect gs.goto_xy(100,100); gs >> collect; gs << collect; gs << flush; the problem is, when i include input and try to execute it, the screen will show up blank, i cant even press esc to shut it down so i have to crash the project exe just to turn it off. my project runs perfectly fine, even when i use output.. but whenever i include input itll wack out. anyone know whats wrong?
  11. gstream fonts

    anyone know where i could find some premade fonts that work with gstream, specifically verdana, or any program that creates them for you?
  12. radio buttons

    anyone know if theres a class already made in allegro/c++ to create them or do you have to build them yourself? because i cant seem to find it
  13. databases

    hey all could anyone elaborate a little on databases for games and how i could create/use one. im using c++ (to which im still a newbie at) and have extremely limited knowledge on them.. mysql? lol thanks ;)
  14. gamestates and the gameloop

    im using dev c++ (edit) wooooo got it fixed!.. had to rewrite the entire thing but got it fixed! lol.. the only problem is the mouse again, it doesnt look like the double buffer is going through it even though it is [Edited by - julian boolean on November 6, 2006 6:51:26 PM]
  15. gamestates and the gameloop

    sorry lol whenever i try to compile it, it will just open and close right away thanks! ill try that out (edit) doing that seems to give me a lot of "undeclared" errors, im guessing because it cant find the graphics/buffer
  • Advertisement