Esempio n. 1
0
 public Parser(Game1 game)
 {
     this.game = game;
     blockFactory = new BlockFactory(game);
     itemFactory = new ItemFactory(game);
     enemyFactory = new EnemyFactory(game);
     latestCheckpoint = new List<Vector2>();
 }
Esempio n. 2
0
 public Sprite(Scene scene, Vector2 position, Texture2D texture, Rectangle sourceRect, int timePerFrame, int numberOfFrames, bool isAnimated)
 {
     this.scene = scene;
        this.isAnimated = isAnimated;
        this.numberOfFrames = numberOfFrames;
        this.position = position;
        this.texture = texture;
        this.timePerFrame = timePerFrame;
        this.sourceRect = sourceRect;
        this.origin.X = 0;
        this.origin.Y = 0;
        Velocity = new Vector2(0, 0);
        blockFactory = new BlockFactory(scene.Game);
        itemFactory = new ItemFactory(scene.Game);
        enemyFactory = new EnemyFactory(scene.Game);
        this.sounds = new SoundMachine(scene.Game);
       // frameWidth = sourceRect.Width / numberOfFrames;
        frameWidth = 16;
        collisionBox = new CollisionBox(position.X, position.Y, 32, SourceRect.Height*2);
 }
Esempio n. 3
0
 protected ItemEntity(ItemFactory factory) : base()
 {
     spriteFactory = factory;
     timer         = 0;
 }
Esempio n. 4
0
        public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            backgroundTexture = game.Content.Load<Texture2D>("SMSearlysky");

            reader = XmlReader.Create("map.xml");

            sprites = new List<Sprite>();

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            blockFactory = new BlockFactory(game);
            itemFactory = new ItemFactory(game);
            enemyFactory = new EnemyFactory(game);
            Parse(reader);

            keyboardCont = new KeyboardController(game, mario);
            gamePadCont = new GamePadController(game, mario);
            collision = new Collision(mario, this);
            MakeFloor();
            // TODO: use this.Content to load your game content here
        }