The Dink Network

Reply to Re: Summoning

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
March 14th 2006, 08:42 PM
duck.gif
wesley
Peasant He/Him United States
 
I've done no testing to confirm this, but I believe there is an error in the example code.

I think the problem with that code is that it is always starting with sprite 0. The first loop will get the first brain 9, the second loop will ignore the first brain 9 and grab the second, but if there are more than 2 brain 9 enemies on screen, it will just keep looping and grabbing the second brain 9 sprite.

What I did in a similar script was before the goto loop; line, store the current sprite in a &temp (global) variable although it could be a local as well.

Here is my code to freeze all sprites on the screen. I might be able to remove some lines but I just wanted to get it working and move on for now.

&temp, &temp2 are global.

//Start Code snippet
&temp = get_sprite_with_this_brain(9, 0);
freeze(&temp);
freezeem:

&temp2 = get_next_sprite_with_this_brain(9, &temp, &temp);
freeze(&temp2);
if (&temp2 == 0)
goto b10;

&temp = &temp2;
goto freezeem;