//Press <CTRL-t>.













                                                                                                                                /* Graphics Not Rendered in HTML */
















//The sprite was created with <CTRL-r>.

U0 ElephantWalk()
{
        I64 sc,
                x = Fs->pix_width >> 1, y = Fs->pix_height >> 1, //Fs is current CTask struct.
                x_last = x;

        AutoComplete;
        WinBorder;
        WinMax;
        DocClear;
        while (TRUE)
        {
                DCFill;
                if (x > x_last)
                {
                        DCSymmetrySet(, x, y, x, y - 1);
                        gr.dc->flags |= DCF_SYMMETRY | DCF_JUST_MIRROR;
                }
                else
                        gr.dc->flags &= ~(DCF_SYMMETRY | DCF_JUST_MIRROR);
                x_last = x;
                Sprite3ZB(gr.dc, x, y, 0, <1>, Sin(8 * tS) / 4);//Use <CTRL-r> "Ptr to Sprite"
                switch (KeyGet(&sc))
                {
                        case 0:
                                switch (sc.u8[0])
                                {//Scan code lowest byte
                                        case SC_CURSOR_UP:
                                                y -= 32;
                                                if (y < 0)
                                                        y = Fs->pix_height;
                                                break;

                                        case SC_CURSOR_DOWN:
                                                y += 32;
                                                if (y > Fs->pix_height)
                                                        y = 0;
                                                break;

                                        case SC_CURSOR_LEFT:
                                                x -= 32;
                                                if (x < 0)
                                                        x = Fs->pix_width;
                                                break;

                                        case SC_CURSOR_RIGHT:
                                                x += 32;
                                                if (x > Fs->pix_width)
                                                        x = 0;
                                                break;
                                }
                                break;

                        case CH_ESC:
                        case CH_SHIFT_ESC:
                                goto ew_done;
                }
        }
ew_done:
        DCFill;
}

ElephantWalk;