/* do_starfield()
** This procedure makes a starfield with pixels
*/
#define MAX_STARS 100
void do_starfield()
{
static int star_x[MAX_STARS,3] ;
static int star_y[MAX_STARS,3] ;
static int first_time = TRUE ;
int l,i,x,y;
/* We just run this code the first time the function is called.
** here, the stars are randomly scattered all over the screen.
*/
if (first_time==TRUE)
{
for (l=0;l<3;l++)
{
for (i=0; iwindow_height-1)
{
star_y[i,l]=0;
star_x[i,l]=rand()%(window_width-1);
}
}
}
}
// Finally we draw everything
int star_color[3];
star_color[0]=makecol16(50,50,50);
star_color[1]=makecol16(130,130,130);
star_color[2]=makecol16(250,250,250);
for (l=0;l<3;l++)
{
for (i=0; i
- Twisted Matrix
starfield generator: logic error?
I am not having any luck getting this procedure to work. It is
supposed to scroll 300 stars from the top of the screen to the
bottom. The stars should have varying intensity and speed.
For some reason, it seems to just be drawing 3 random stars every
time the procedure is called. Any clues? (Its probly somthing
dumb) thanks.
- Twisted Matrix
the ''for'' statements didnot display right for some reason. I guess it thought it was a HTML tag or somthing.
here it is spaced
for ( i = 0 ; i < MAX_STARS ; i++ )
- Twisted Matrix
here it is spaced
for ( i = 0 ; i < MAX_STARS ; i++ )
- Twisted Matrix
- Twisted Matrix
By
did you mean
?
static int star_x[MAX_STARS,3];static int star_y[MAX_STARS,3];
did you mean
static int star_x[MAX_STARS][3];static int star_y[MAX_STARS][3];
?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
It seems to work by changing every [?,?] to [?][?], although it looks more like snow falling than a star field. What compiler are you using? If it''s GCC or a port of it you should add -Wall to the compiler options so it tells you when you do stupid things.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement