The Dink Network

Reply to Re: Script created Sprite that can be commanded from multiple other scripts

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:
 
 
April 30th 2020, 09:25 PM
spike.gif
You can make &dude a global variable. Then you could just do &dude = &current_sprite in the dude's script, and you could move him with move_stop(&dude, blah blah blah) from the bookshelf's script.

Alternatively, if the dude is the only sprite on the screen with a specific brain (such as 9 or 16), or you give him a custom brain, getting his sprite from the bookshelf script is as easy as:

int &dude = get_sprite_with_this_brain(9,0)
move_stop(&dude, blah blah blah)

Even if there are multiple sprites with the same brain on the screen, it's possible to single out the dude by giving him some unique property that other sprites don't have and looking for that in the bookshelf script. That's a little more complicated, though, so I won't go into it unless that's needed. =)