Sp_dir question
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.
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.

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.
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.