Thread: Allegro help-o

  1. #76
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    >> and i dont think im better than you...

    i know you dont think you KNOW
    What is C++?

  2. #77
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    here is a screen shot of an intense battle between me and nothing....
    What is C++?

  3. #78
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    That looks good, way better than my bullets. I think I recognize that plane from somewhere, say Total Annihilation? Does your ship move diagonaly? I quit working on my shooter, like I do everything, like the Sniper game, like this Windows text editor I was making. You ever read Pixelate? I think it is cool, I would like to write my own online game programming magazine, but I do not know enough, yet... I am trying to learn to do sprite animation, know any resources?

  4. #79
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    it doesnt move diagonally but it has b4...

    and... I actually got that ship by taking a screen shot of a game called space rocks and then i modified it a bit and poof...

    umm... i dont know of anywhere to find animation help...

    u know where hasnt helped?
    What is C++?

  5. #80
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    does any one know how to make one bitmap

    BITMAP* baddy = NULL;

    and use it for multiple ships?

    i tried just using multiple draw_sprites with different X coords but then i couldnt do collision detection on em...

    the only other way i know of would be

    BITMAP* baddy1;
    BITMAP* baddy2;
    ect...
    What is C++?

  6. #81
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Just use one and draw the where you need it.

    Code:
    BITMAP *badguy = load_bitmap("badguy.bmp", NULL);
    
    struct enemy {
      int x, y;
      bool exists;
    } enemies[10];
    
    enemies[0].x = 20;
    enemies[0].y = 20;
    enemies[1].x = 200;
    enemies[1].x = 200;
    
    draw_sprite(badguy, enemies[0].x, enemies[0].y);
    draw_sprite(badguy, enemies[1].x, enemies[1].y);

  7. #82
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    thanx... arrays... doh, i should have thought of that
    What is C++?

  8. #83
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Arrays of structures are very usefull. You can use them to create different ships, bullets, starts, power ups or anything. You can even save space my using 'new'.

    Code:
    struct bullet {
      int x, y;
    } *bullets[100];
    
      bullets[0] = new bullet;
    I think it would go something like that. I am gonna learn to use linked list, so there is no limit on the amount of bullets.

  9. #84
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Josh, I changed all of my code from when you first looked at my program so that all of the flickering would be gone (I used a buffer). The last piece of code I posted I still have no idea why it doesn't work. Thanks for the help with your code, though.

    Both of your games look really good.

    But a lot of the credit has to go to Josh.

  10. #85
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    yup, josh did help us out here.. i dunno how he got so friggen smart all of a sudden...

    [edit]
    how did you use a background josh?
    [/edit]

    [edit2]
    oh, this will just be a test game.. not the full complete game...
    after i get the collision detection right i might either work on the complete game... or attempt a test puzzle game (tetris, tetris attack... )
    [/edit2]

    [edit3]
    u guys find it wierd that were almost the only ones to post on this thread?
    [/edit3]
    Last edited by Vicious; 06-09-2002 at 05:05 PM.
    What is C++?

  11. #86
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    What he did was before he drew the sprites to the buffer he blit the background to the buffer.

    Wow, just a few days ago I would have had no idea what any of that meant. Pretty cool.

    I think I'm going to stick with this game for now. I'm kind of going to make it like an Asteroids style of game. Like if you press ctrl+arrow key the plane will turn in that direction instead of move in that direction.

  12. #87
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    um... y ctrl + arrow?

    why not arrow roteates or (pivot_sprite) and up thrusts?

    that would be hard...
    What is C++?

  13. #88
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    how about scrolling the background?
    What is C++?

  14. #89
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    I think with allegro, sometimes it will not let you see if two keys are being pressed at the same time. So it will not always work testing if the user is holding control while he hits the arrow keys.

    Code:
    if(key[KEY_LEFT] && key[KEY_CTRL]) // Will not always work
    By the way, I do not know if KEY_CTRL is the right name, it could be KEY_CONTROL.

    You should do it like origional asteroids, when you press left or right, it rotates the ship, press up to accelerate, press down to slow down. Making it wrap around to the other side of the screen would not be hard either. Good luck to you, let me know if you need any help.

    I can never think of any games to create. I just made one where you walk down the road, you have a joint, if you press space, it shows him hit the joint and blow out smoke. Once you hit the joint a certain amount of times the colors get distorted, once you hit it alot more, the guy grows huge, and starts to spin. Everything works on it now, except for the spinning part, I could not figure out rotate_sprite(). If you are interested in this game, I could upload it to my site, it is too big to upload to this forum. Sorry if you are offended by any of that.

    I suck at art, I can not find many free sprites. If you know where I can find alot of various sprites (rpgs, spaceships, cars, anything) please let me know. I want to make a topview racing game next, I think that is a little (a lot) beyond my skill though.

    I do not know how to do scrolling, where can I learn how to do this? Would I create a bitmap as large as my map, and when I blit it, only blit the portion to be seen to the screen? I could do that, but it seems an awfull waste of memory. I am gonna get to coding on my racing game I guess, if you know how to use rotate_sprite() please let me know.

  15. #90
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    I just looked in includes/allegro/keyboard.h, it is KEY_LCONTROL and KEY_RCONTROL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro in C for a newb
    By Ideius in forum C Programming
    Replies: 5
    Last Post: 12-29-2005, 04:36 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. Allegro programming in a window
    By Person Man in forum Windows Programming
    Replies: 0
    Last Post: 11-16-2001, 03:23 PM