Thread: need help

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    479

    need help

    this code has driven me crazy
    most of it i have found at a tutorial site.
    its a spaceshooter game (yes the same as before)
    my problem is that i want the ship to "shoot" a laser beam
    when u press a certain key i almost solved that problem once
    but then it shot one beam then the game crashed
    but then i forgot even that

    btw it is an allegro game



    //code:




    #include <allegro.h> // You must include the Allegro Header file



    int main(int argc, char *argv[])
    {



    allegro_init(); // Initialize Allegro
    install_keyboard(); // Initialize keyboard routines



    set_color_depth(16); // Set the color depth

    set_gfx_mode(GFX_AUTODETECT,640,480,0,0); //Change our graphics mode to 640x480
    BITMAP*bild;
    bild=load_bitmap("c:\\temp\\ship.bmp",0);

    BITMAP *my_pic; //Declare a BITMAP called my_pic
    my_pic = load_bitmap("c:\\temp\\rocket.bmp", NULL); // Load our picture

    BITMAP *buffer; //Declare a BITMAP called buffer.

    buffer = create_bitmap(640,480); //Create an empty bitmap.

    while(!key[KEY_ESC])//If the user hits escape, quit the program
    {


    if(key[KEY_RIGHT])// If the user hits the right key, change the picture's X coordinate
    {
    my_pic_x ++;// Moving right so up the X coordinate by 1
    }
    if(key[KEY_LEFT])// Ditto' - only for left key
    {
    my_pic_x --;// Moving left, so lower the X coordinate by 1
    }
    if(key[KEY_UP])// If the user hits the up key, change the picture's Y coordinate
    { for(int w=500;w>0
    {



    putpixel(buffer,my_pic_x,w+10,0);
    putpixel(buffer,my_pic_x,w--,500);

    }
    if(key[KEY_DOWN])// Ditto' - only for down
    {
    my_pic_y ++;// Moving down, so up the Y coordinate by 1
    }


    acquire_screen();// Get the screen
    draw_sprite(buffer, bild, my_pic_x, my_pic_y);//Draw the picture to the buffer
    blit(buffer, screen, 0,0,0,0,640,480);//Draw the buffer to the screen
    release_screen();// Release it

    }



    destroy_bitmap(bild);//Release the bitmap data
    destroy_bitmap(buffer);//Release the bitmap data


    return(0);// Exit with no errors
    }
    END_OF_MAIN();




    //end of code

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    any help is apriciated
    thanx

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Click on the last link in my signature

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    u **** i had read your post about the [startcode][endcode]
    thing thats why i used them to open your eyes next time

  5. #5
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by pode
    u **** i had read your post about the [startcode][endcode]
    thing thats why i used them to open your eyes next time
    //code and //end of code don't count as code tags.

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    but u get the idea?!!

  7. #7
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Yes I do get the point.....but do you get mine??

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    u mean use them so people know where the code begins...
    ..right?

  9. #9
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    More like "Use them so people can read your code and don't ignore you" I know for sure I am not gonna read through all that poorly formated attempt to code you just posted.

  10. #10
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Barjor was right on the dot....and pode was also right.......no one wants to read through jibberish (that's what it looks like without correct tags) and yes, so people do know where your code begins.

  11. #11
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    fuc'k you barjor the code isn't that messy

  12. #12
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    if u know how to program that is!

  13. #13
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    enough bull-**** those who think they can HELP plaese post
    your reply.

    or else u know were to put it
    thanx

  14. #14
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Dude, we're just making a point.......at least edit your first post, then we can answer your question........a mod should read this thread.....so.....exciting.........

  15. #15
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    It might be excelent code but I'm not gonna find out without proper formating

Popular pages Recent additions subscribe to a feed