public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame <CosmicRocksPartIIGame> .Create(launchArguments, Window.Current.CoreWindow, this);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------------------
        // Class constructors and initialization functions

        internal BulletObject(CosmicRocksPartIIGame game, Texture2D texture)
            : base(game, Vector2.Zero, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;
            // Set the origin to the top-center of the sprite
            Origin = new Vector2(texture.Width / 2, 0);
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal StarObject(CosmicRocksPartIIGame game, Texture2D texture)
            : base(game, Vector2.Zero, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set a random position
            PositionX = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Width);
            PositionY = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Height);

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Set the scale range
            _scaleMin = GameHelper.RandomNext(0.1f, 0.6f);
            _scaleMax = _scaleMin + GameHelper.RandomNext(0.1f, 0.4f);
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal SpaceshipObject(CosmicRocksPartIIGame game, Texture2D texture, Vector2 position)
            : base(game, position, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Set the scale
            Scale = new Vector2(0.2f, 0.2f);

            // We are not (yet) exploding
            ExplosionUpdateCount = 0;

            // Activate the shield
            _shieldTime = MaxShieldTime;
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal RockObject(CosmicRocksPartIIGame game, Texture2D texture, int generation, float size, float speed)
            : base(game, Vector2.Zero, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set a random position
            PositionX = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Width);
            PositionY = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Height);

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Store the other constructor parameters
            _constructorSpeed = speed;
            _generation       = generation;

            // Initialize the remainder of the rock properties
            InitializeRock(size);
        }