File size: 1,332 Bytes
806d4b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
//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 (GetKey(&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;
|