The Dink Network

Reply to Re: Multiple Sprites

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:
 
 
October 27th 2007, 03:17 PM
dinkdead.gif
Every time you do "&var = number" the variable is now that number and "forgets" what it was before, so you can use it for different things but if you create a few sprites the variable will only refer to the last one.

Example from my D-Mod:

void main(void)
{
int &bug;

&bug = create_sprite(120, 99, 9, 131, 1);
sp_script(&bug, "v23-bug");

&bug = create_sprite(63, 147, 9, 133, 1);
sp_script(&bug, "v23-bug");

&bug = create_sprite(101, 233, 9, 131, 1);
sp_script(&bug, "v23-bug");

&bug = create_sprite(111, 316, 9, 131, 1);
sp_script(&bug, "v23-bug");

&bug = create_sprite(182, 185, 9, 133, 1);
sp_script(&bug, "v23-bug");

//etc...
}

That makes a load of different bugs all with the same script attached but I'd have to give each it's own variable if I wanted to do something with them later.