示例#1
0
 public Field(Game game, int id, Vector2 p)
     : base(game)
 {
     this.game = (Main)game;
     this.textureId = id;
     position = p;
 }
示例#2
0
 public Number(Game game, int value, Vector2 position)
     : base(game)
 {
     this.value = value;
     this.position = position;
     this.game = (Main)game;
     createdTime = DateTime.Now;
 }
        public void Initialize(ContentManager content, String texturePath, int screenWidth, int yPos, Main game)
        {
            this.game = game;

            // Load the background texture we will be using
            texture = content.Load<Texture2D>(texturePath);

            // Set the speed of the background
            this.speed = game.speed;

            // If we divide the screen with the texture width then we can determine the number of tiles need.
            // We add 1 to it so that we won't have a gap in the tiling
            positions = new Vector2[screenWidth / texture.Width +1];

            // Set the initial positions of the parallaxing background
            for (int i = 0; i < positions.Length; i++)
            {
                // We need the tiles to be side by side to create a tiling effect
                positions[i] = new Vector2(i * texture.Width, yPos);
            }
        }