|
|
|
|
|
|
|
|
|
|
|
|
|
|
| }
|
|
|
|
|
|
|
| }
|
|
|
|
|
|
|
| public class MyObject
|
|
|
| {
|
|
|
| public int x,y;
|
|
|
| public int ox, oy;
|
|
|
| public Graphics xGraph;
|
|
|
| public int index = 0;
|
|
|
| public ObjectType OT;
|
|
|
| public MyObject(ObjectType T,Graphics g,int x, int y)
|
|
|
| {
|
|
|
| this.x = x;
|
|
|
| this.y = y;
|
|
|
| OT = T;
|
|
|
| xGraph = g;
|
|
|
| ox = oy = 0;
|
|
|
|
|
|
|
| TimerGenerator.AddTimerEventHandler(TimerType.TT_50, OnChange);
|
|
|
| }
|
|
|
| public void OnChange(Object sender, EventArgs e)
|
|
|
| {
|
|
|
| index++;
|
|
|
| if (index > 3)
|
|
|
| index = 0;
|
|
|
|
|
|
|
| x++;
|
|
|
| ox++;
|
|
|
| if (ox > 20)
|
|
|
| {
|
|
|
| ox = 0;
|
|
|
| x -= 20;
|
|
|
| oy++;
|
|
|
| y++;
|
|
|
| }
|
|
|
|
|
|
|
| if(oy > 20)
|
|
|
| {
|
|
|
| y -= 20;
|
|
|
| x -= 20;
|
|
|
| oy = 0;
|
|
|
| ox = 0;
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| }
|
|
|
| public void Draw()
|
|
|
| {
|
|
|
| Rectangle SRC = new Rectangle(index*16,0,16,16);
|
|
|
| Rectangle DEST = new Rectangle(x,y,16,16);
|
|
|
| xGraph.DrawImage(ImageGenerator.GetImage(OT), DEST, SRC, GraphicsUnit.Pixel);
|
|
|
| }
|
|
|
|
|
|
|
| }
|
|
|
| }
|
|
|
|