-
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
-
any help is apriciated
thanx
-
I am the worst best coder
Click on the last link in my signature
-
u **** i had read your post about the [startcode][endcode]
thing thats why i used them to open your eyes next time
-
I am the worst best coder
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.
-
-
I am the worst best coder
Yes I do get the point.....but do you get mine??
-
u mean use them so people know where the code begins...
..right?
-
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.
-
I am the worst best coder
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.
-
fuc'k you barjor the code isn't that messy
-
if u know how to program that is!
-
enough bull-**** those who think they can HELP plaese post
your reply.
or else u know were to put it
thanx
-
I am the worst best coder
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.........
-
It might be excelent code but I'm not gonna find out without proper formating
Popular pages
Recent additions