You want it to face in one direction, but be behind link?
This should do the trick:
Code:
import "std.zh"
const int animal_tile = 1234; //tile
const int animal_cset = 2; //cset
const int animal_speed = 8; //animation speed, in frames.
int animal_frame = 0; //frame, don't change this
int animal_timer = 0; //animation timer, don't change this
global script slot_2 {
void run() {
while(true) {
if(Link->Item[165]) animalbuddy();
Waitframe();
}
}
void animalbuddy() {
int dx;
int dy;
if (Link->Dir==0)
{
dx=Link->X;dy=Link->Y+16;
}
if (Link->Dir==1)
{
dx=Link->X;dy=Link->Y-16;
}
if (Link->Dir==2)
{
dx=Link->X+16;dy=Link->Y;
}
if (Link->Dir==3)
{
dx=Link->X-16;dy=Link->Y;
}
Screen->DrawTile(2, dx, dy, animal_tile + animal_frame, 1, 1, animal_cset, 1, 0, 0, 0, 0, true, 128);
animal_timer += 1;
if(animal_timer >= animal_speed) {
animal_timer = 0;
if(animal_frame == 0) animal_frame = 1; else animal_frame = 0;
}
}
}
lucas, I stole you if block
Regardless, this will activate the instant you pick up item #165, and will draw a tile behind link until the moment you lose the item.
You can customize it by changing the three consts at the top. Also, if you want it to be translucent (eg, a ghost or something), change the 128 at the end of the "Screen->DrawTile" line to a 64.
It compiles, but I haven't tested it.