Professional Documents
Culture Documents
Ni dung chnh
Gii thiu XNA
Cu trc ca mt Project game XNA Xy dng game 2D trong XNA: o Input: Image texture, Audio o iu khin chut v bn phm
XNA l g?
XNA l mt b cng c s dng cho mi trng c thi gian chy game qun l c pht trin bi Tp on Microsoft. B cng c XNA bao gm: o XNA Framework o XNA Build o XNA Game Studio
c tnh ca XNA
H tr ha 2D & 3D
Truy cp n th vin HLSL (High level shader language)
Pixel and vertex shaders
H tr v m thanh
Cng c h tr m thanh XACT
base.Initialize();
} Phng thc load ni dung cho game
System.Math
Hm Math.ATan2(x,y) tnh ton gc Hm Cos v Sin tnh gc tr v mt Vector2
MathHelper
L mt phin bn ca XNA System.Math Hng s: PI, TwoPi, PiOverFour, E, Log10E Phng thc: DegreesToRadians, Clamp, CatMullRom, Lerp
V m hnh 2D vi SpriteBatch
Begin
Starts a batch
Draw
Paints a Texture2D to the screen
DrawString
Paints a SpriteFont + a string to the screen
End
Commit the batch
iu khin bn phm
banPhim = Keyboard.GetState();
iu khin chut
toaDoPhiThuyen.X = Mouse.GetState().X;
toaDoPhiThuyen.Y = Mouse.GetState().Y;
}
}
Game Loop
UnloadContent (Theoretically)
Update
Draw