예제 #1
0
파일: Game1.cs 프로젝트: jt222ic/game_lab2
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            camera = new Camera(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, 1, 1);
        }
예제 #2
0
파일: flame.cs 프로젝트: jt222ic/game_lab2
        public void Draw(SpriteBatch spritebatch, Camera camera)
        {
            spritebatch.Begin();
            frameX = frame % numberFrameX;   //teachc0de
            frameY = frame / numberFrameX;
            Rectangle test = new Rectangle(frameX*128,(int) frameY*128, TrueFlame.Width/numberFrameX, TrueFlame.Height/numberFrameY);
            Vector2 scale = camera.ScaleObject(TrueFlame.Width / numberFrameX, TrueFlame.Height / numberFrameY);// TExture2d width and height dela med numbersof frames
            spritebatch.Draw(TrueFlame, new Vector2(100, 100), test ,Color.White,0,new Vector2(0,0),scale,SpriteEffects.None,0);

              /// hittar inte animationens position, tittar på youtube eller använder av variabeln numberofFrame x eller number of frameY

            spritebatch.End();
        }