Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Cloning objects on the fly?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Sheep   Members   -  Reputation: 152

Like
Likes
Like

Posted 26 August 2001 - 03:31 AM

Hello everyone. Well, once again I have encountered a problem. I am creating a small subhunt clone, and I am having trouble with firing multiple depth charges, namely that I don''t know to make them work. So far, the part of the main game loop that relates to this ship looks something like this: if(Spacebar is down) // fire the torpedo { // set position of the depth charge to that of the ship Set_Position (ship_pos_x and ship_pos_y); // set the downward velocity velocity = 4; } if (Space was pressed) { Draw_Depth_Charge (); } With the code like this, I can only fire one depth charge. How could I make it so that if space has been pressed more than once, It will draw another depth charge? I know the answer is probably rather simple, but I am rather high on jellybeans, and my brain is not functioning correctly. Thanks, your "wannabe" friend.

Sponsor:

#2 GuyJohnston   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 06:53 AM

You might do something like this:

  
struct weapon { float x, y, z;
BOOL active; // note set all active to FALSE

} depth_charge [ 25 ];

int dch_count = 0;// a global


if ( Space Bar is Down )
{
Set_Position( ship_position_x ,ship_position_y );
// of depth_charge [ dch_count ].x,

// depth_charge [ dch_count ].y

velocity = 4;
depth_charge [ dch_cnt ].active = TRUE;
if ( dch_count++ > 24 )
dch_count = 24;
}// end if


If ( Space was pressed )
{
// loop through the active depth charges drawing the

// active ones


for ( int count = 0 ; count < 25 ; count++ )
{
if ( depth_charge [ count ].active == TRUE )
Draw_Depth_Charge( depth_charge [ count ].x,
depth_charge [ count ].y );

}// end for count


}// end for Space



#3 GuyJohnston   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 11:40 AM

I sent you an E-MAIL, not sure if you got it.

It went:

Sorry to hear it did''nt work for you.
I can''t do much without seeing the code.
I assume you where adjusting the view matrix for
each missle drawn. But I don''t know how your code
was laid out ? I used similar code for multiple pixel
explosion algorithms.

Can you E-MAIL it me ?

guyjohnston@kawartha.com





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS