【Xbox360】 XNA Game Studio その5 【C#】
■ このスレッドは過去ログ倉庫に格納されています
0716名前は開発中のものです。
2008/05/01(木) 10:40:09ID:8KeOwWsDusing System;using Microsoft.Xna.Framework;using Microsoft.Xna.Framework.Input
;using Microsoft.Xna.Framework.Graphics;namespace W{class G:Game{static void
Main(){new G().Run();}GraphicsDeviceManager g;SpriteBatch s;Texture2D t;
MouseState m,n;Random r=new Random();int b;string c=new string(new char[]{
'\x65E9','\x304F','\x7BB1','\x9001','\x308C'});struct O{public int x,y,w,h;}O
p,l;O[]e=new O[100];G(){g=new GraphicsDeviceManager(this);Window.Title="0点";
IsMouseVisible=true;l.y=-16;for(int i=0;i<100;i++){e[i].x=r.Next(800);e[i].y=-
r.Next(3000);e[i].w=16+r.Next(50);e[i].h=16+r.Next(50);}}protected override
void LoadContent(){s=new SpriteBatch(GraphicsDevice);t=new Texture2D(
GraphicsDevice,1,1,1,TextureUsage.None,SurfaceFormat.Color);t.SetData<int>(
new int[]{-1});}protected override void Update(GameTime a){n=m;m=Mouse.
GetState();p.x=m.X;p.y=m.Y;if((int)m.LeftButton==1&&(int)n.LeftButton==0&&l.y<
0){l.x=p.x;l.y=p.y;}l.y-=4;Rectangle q=new Rectangle(l.x,l.y,5,15);for(int i=0
;i<100;i++){++e[i].y;if(l.y>=0&&q.Intersects(new Rectangle(e[i].x,e[i].y,e[i].
w,e[i].h))){e[i].y=600;l.y=-15;b++;if(b>=36)Window.Title=b.ToString()+"0点 "+
c;else Window.Title=b.ToString()+"0点";break;}}base.Update(a);}protected
override void Draw(GameTime a){GraphicsDevice.Clear(Color.Black);s.Begin();
foreach(O o in e){s.Draw(t,new Rectangle(o.x,o.y,o.w,o.h),Color.Blue);}s.Draw(
t,new Rectangle(p.x,p.y,15,15),Color.White);s.Draw(t,new Rectangle(l.x,l.y,5,
15),Color.Red);s.End();base.Draw(a);}}}
■ このスレッドは過去ログ倉庫に格納されています