欢迎来到天天文库
浏览记录
ID:20362305
大小:181.85 KB
页数:19页
时间:2018-10-12
《c动画编程基础例子》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、c#基础2015usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.Drawing.Imaging;namespaceZWDZJS{classZombie{publicPointlocation;publicTmageimage;publicintindex;publicintcount;publicintLifezombie;publicZombie(){image=Resources.Zombie;count=
2、image.GetFrameCount(FrameDimension.Time);Lifezombie=300;}publicvoidPlay(){index++;if(index==count)index=0;image.SelectActivcFrame(FrameDimension.Time,index);//将?当iiA前i备要。a显?示°?的1?图a?片?““置?为a动态,?图a?片?的l?lndcx所"’对?应《
3、的1?帧?)publicvoidmove(){location.X-=1;}publicvoidDisplay(Graph
4、icsg){g.DrawImage(image,location);publicRectangleGctRangcOreturnnewRectangle(1ocation,image.Size);}}usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.Drawing.Imaging;usingSystem.Timers;namespaceZWDZJS{classSun{publicPointlocation;pub
5、licImagesun;publicintindex;publicintcount;publicSun(){sun=Resources.Sun;count=sun.GetFrameCount(FrameDimension.Time):location=newPoint(location.X-1080,location.Y);}publicvoidDisplay(Graphicsg){g.Drawlmage(sun,location);>publicvoidPlay(){index++;if(index==count)index=0;sun.Sel
6、ectActiveFrame(FrameDimension.Time,index);}publicvoidMove(){location.Y+=1;}returnnewRectangle(location,sun.Size);)usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Drawing;usingSystem.Drawing.Imaging;namespaceZWDZJS{classPlants{publicPointlocation;Image
7、image;publicintindex;publicintcount;publicPlants(){image=Resources.Peashooter;//表1"示°?帧?总A"1数°ylocation=newPoint(160,26);count=image.GetFrameCount(FrameDimension.Time);//返Q!i回?指?定j§维?度”"的t?帧?数°7。0publicvoidPlay(){index++;if(index==count)index=0;image.SelectActiveFrame(FrameDi
8、mension.Time,index);//将?当UA前i5要"a显?示°?的1?图3?片?设:""迓?为3动0态,?图3?片?的1?1“(^所‘‘’对?应叫的1?帧?)publicvoidDiaplay(Graphicsg){g.DrawImage(image,location);)usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Drawing;namespaceZWDZJS{classPeashooterCard{publicPointlocat
9、ion;publicinttimer;publicintenabled;Image口images;publicPeashooterCar
此文档下载收益归作者所有