public Sprite(Texture2D texture, int frameWidth, int frameHeight, int frameCount, float frameTime = 200)
            : this(texture)
        {
            this.frameWidth = frameWidth;
            this.frameHeight = frameHeight;
            this.frameCount = frameCount;
            this.currentFrame = 0;

            Origin = new Vector2(frameWidth / 2, frameHeight / 2);

            SourceRectangle = new Rectangle(0, 0, frameWidth, frameHeight);

            frameTimer = new Timer(frameTime);
        }
        public GameScene()
            : base()
        {
            enemy_spawn_timer = new Timer(3000);

            player = new Player(Resources.GetTexture("Ship"), new Vector2(100, 100), 5);

            background1 = new ScrollingBackground(new Vector2(-100,-100), 40, new Sprite(Resources.GetTexture("StarWars")));
            background2 = new ScrollingBackground(new Vector2(0,0), 30, new Sprite(Resources.GetTexture("StarWars")));

            Game1.camera.setZoom(1.5f);

            Vector2 offset = new Vector2(Game1.screen_size.Width, Game1.screen_size.Height) * 0.5f;

            Game1.camera.PositionOffset = offset;
            Game1.camera.setOffset(offset);
        }
Example #3
0
        public override void Start()
        {
            enemy_spawn_timer = new Timer(3000);

            player = new Player(Resources.GetTexture("Ship"), new Vector2(100, 100), 5);
            background1 = new ScrollingBackground(new Vector2(-100, -100), 40, new Sprite(Resources.GetTexture("StarWars")));
            background2 = new ScrollingBackground(new Vector2(0, 0), 30, new Sprite(Resources.GetTexture("StarWars")));

            camera.setZoom(1.0f);

            Vector2 offset=new Vector2(Game1.screen_size.Width, Game1.screen_size.Height) * 0.5f;

            camera.PositionOffset = offset;
            camera.setOffset(offset);

            hud = new HUDScene();

            SceneSys.OpenScene(hud);
        }