Example #1
0
        public Mario(Game1 game, Scene scene)
        {
            MarioFactory = new MarioFactory(game);
            currentSprite = (MarioSprite)MarioFactory.MakeProduct(1);
            powerupStateFactor = 0;
            actionStateFactor = 1;
            direction = 1;
            idle = new MarioIdleState(this);
            jump = new MarioJumpingState(this);
            walk = new MarioWalkingState(this);
            crouch = new MarioCrouchingState(this);
            fall = new MarioFallingState(this);
            standard = new MarioStandard(this);
            super = new MarioSuper(this);
            fire = new MarioFire(this);
            dead = new MarioDead(this);
            powerupState = standard;
            currentState = idle;
            previousState = currentState;
            previousSprite = currentSprite;
            this.game = game;
            this.scene = scene;
            gravity = scene.Gravity;

            isGrounded = false;

            points = 0;
            coins = 10;
            lives = 3;
            sounds = new SoundMachine(game);
        }
 public OtherCollision(Mario mario, Scene scene, Quadtree quadtree)
 {
     this.scene = scene;
     this.mario = mario;
     this.sprites = scene.SSprites;
     this.movsprites = scene.MovSprites;
     this.quad = quadtree;
     this.sounds = new SoundMachine(scene.Game);
     this.nearObjects = new List<Sprite>();
 }
Example #3
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);
 }
Example #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            scene = new Scene(this);
            scene.LoadContent();

            // TODO: use this.Content to load your game content here
        }
Example #5
0
 public Collision(Mario mario, Scene scene)
 {
     this.mario = mario;
     this.sprites = scene.Sprites;
 }
Example #6
0
 public DestroyBlockCommand(Scene receiver)
 {
     this.receiver = receiver;
 }
Example #7
0
 public PlaceBlockCommand(Scene receiver)
 {
     this.receiver = receiver;
 }
Example #8
0
 public GoombaWalkingSprite(Scene scene, Vector2 position, Texture2D texture, Rectangle sourceRect, int timePerFrame, int numberOfFrames, bool isAnimated)
     : base(scene, position, texture, sourceRect, timePerFrame, numberOfFrames, isAnimated)
 {
     this.scene = scene;
     Velocity = new Vector2(-5, 0);
 }
Example #9
0
 public GoombaSquishedSprite(Scene scene, Vector2 position, Texture2D texture, Rectangle sourceRect, int timePerFrame, int numberOfFrames, bool isAnimated)
     : base(scene, position, texture, sourceRect, timePerFrame, numberOfFrames, isAnimated)
 {
 }
Example #10
0
 public MushroomSprite(Scene scene, Vector2 position, Texture2D texture, Rectangle sourceRect, int timePerFrame, int numberOfFrames, bool isAnimated)
     : base(scene, position, texture, sourceRect, timePerFrame, numberOfFrames, isAnimated)
 {
     Velocity = new Vector2(-5, 0);
 }
Example #11
0
 public EnemyFactory(Game1 game)
 {
     this.game = game;
     this.texture = game.Content.Load<Texture2D>("Enemies");
     this.scene = game.scene;
 }