The Dink Network

Sp_dir question

July 15th 2003, 10:29 AM
peasantmb.gif
How to make a sprite (like a knight) use an sp_dir to where is Dink?
Emh. I mean, in a void main() proc, and the sprite turns where Dink entered the screen (if Dink is on the left, the sprite turns to sp_dir(&sprite, 6); if Dink is on the right, sp_dir(&sprite, 4).

I don't know if this can be done, since I have never seen that happening in a d-mod, but if it can be done, please help.
July 15th 2003, 10:45 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Make a global called &last_map. Then place on the adjoining four screens a sprite with the following script:

void main(void)
{
&last_map = &player_map;
}

Then on the screen with the knight:

void main(void)
{
if (&last_map == xyz)
{
//screen north
sp_dir(&sprite, 8);
}
if (&last_map == xyz)
{
//screen east
sp_dir(&sprite, 6);
}
if (&last_map == xyz)
{
//screen south
sp_dir(&sprite, 2);
}
if (&last_map == xyz)
{
//screen west
sp_dir(&sprite, 4);
}
//other code
}

Where xyz are the numbers of the four adjoining screens. Of course, the number of the screen north should be placed in the if statement of the northern screen.
July 15th 2003, 11:03 AM
peasantmb.gif
Thanks Simeon.
July 16th 2003, 04:21 PM
pq_frog.gif
Ric
Peasant They/Them Canada
 
Another way I have done is:
sp_follow(&current_sprite,1);
wait(100);
freeze(&current_sprite);
sp_follow(&current_sprite,0);
...of course that sprite needs brain 9 to use sp_follow (just like sp_target).