Beispiel #1
0
        public static BlockEntity BuildBlockEntity(Blocks type, Vector2 loc, EventSoundEffects sounds)
        {
            BlockEntity toReturn = null;

            switch (type)
            {
            case Blocks.UsedBlock:
                toReturn = new UsedBlockEntity(loc, sounds);
                break;

            case Blocks.QuestionBlock:
                toReturn = new QuestionBlockEntity(loc, sounds);
                break;

            case Blocks.BrickBlock:
                toReturn = new BrickBlockEntity(loc, sounds);
                break;

            case Blocks.HiddenBlock:
                toReturn = new HiddenBlockEntity(loc, sounds);
                break;

            case Blocks.PipeBlock:
                toReturn = new PipeBlockEntity(loc, sounds);
                break;

            case Blocks.BridgeBlock:
                toReturn = new BridgeBlockEntity(loc, sounds);
                break;
            }

            return(toReturn);
        }
Beispiel #2
0
 public AxeEntity(Vector2 loc, EventSoundEffects sounds) : base(loc, sounds)
 {
     Sounds          = sounds;
     InitialPos      = loc;
     Sprite          = new Axe(loc);
     EntityCollision = new ItemCollision(this);
 }
Beispiel #3
0
        public static Entity BuildItemEntity(ItemType type, Vector2 loc, EventSoundEffects sounds)
        {
            Entity toReturn = null;

            switch (type)
            {
            case ItemType.Flower:
                toReturn = new FlowerEntity(loc, sounds);
                break;

            case ItemType.Coin:
                toReturn = new CoinEntity(loc, sounds);
                break;

            case ItemType.RedMushroom:
                toReturn = new RedMushroomEntity(loc, sounds);
                break;

            case ItemType.GreenMushroom:
                toReturn = new GreenMushroomEntity(loc, sounds);
                break;

            case ItemType.Star:
                toReturn = new StarEntity(loc, sounds);
                break;

            case ItemType.Axe:
                toReturn = new AxeEntity(loc, sounds);
                break;
            }
            return(toReturn);
        }
Beispiel #4
0
 public RedMushroomEntity(Vector2 loc, EventSoundEffects sounds) : base(loc, sounds)
 {
     Sounds          = sounds;
     Sound           = EventSoundEffects.EventSounds.CollectPowerUp;
     InitialPos      = loc;
     Sprite          = new RedMushroom(loc);
     EntityCollision = new ItemCollision(this);
     State           = new StandardItemState(this);
     State.NextState = new MovingItemState(this);
 }
Beispiel #5
0
 public CoinEntity(Vector2 loc, EventSoundEffects sounds) : base(loc, sounds)
 {
     Sounds          = sounds;
     Sound           = EventSoundEffects.EventSounds.CollectCoin;
     InitialPos      = loc;
     Sprite          = new Coin(loc);
     EntityCollision = new ItemCollision(this);
     State           = new StandardItemState(this);
     State.NextState = new StandardItemState(this);
 }
Beispiel #6
0
 public UsedBlockEntity(Vector2 loc, EventSoundEffects sounds) : base(loc, sounds)//there are no sounds for used blocks
 {
     Factory = new BlockFactory();
     BState  = new UsedBlockState(this);
     Sprite  = Factory.BuildSprite(Factory.FindType(BState), loc);
     BState.Enter(null);
     SpritePosition  = loc;
     InitialPos      = loc;
     EntityCollision = new BlockCollision(this);
 }
Beispiel #7
0
 public HiddenBlockEntity(Vector2 loc, EventSoundEffects sounds) : base(loc, sounds)
 {
     Sounds  = sounds;
     Factory = new BlockFactory();
     BState  = new HiddenBlockState(this);
     Sprite  = Factory.BuildSprite(Factory.FindType(BState), loc);
     BState.Enter(null);
     SpritePosition  = loc;
     InitialPos      = loc;
     EntityCollision = new BlockCollision(this);
 }
Beispiel #8
0
 public PipeBlockEntity(Vector2 loc, EventSoundEffects eventSound) : base(loc, eventSound)
 {
     Sounds  = eventSound;
     Factory = new BlockFactory();
     BState  = new PipeBlockState(this);
     Sprite  = Factory.BuildSprite(Factory.FindType(BState), loc);
     BState.Enter(null);
     SpritePosition  = loc;
     InitialPos      = loc;
     EntityCollision = new BlockCollision(this);
     Warpable        = false;
     WarpVelocity    = new Vector2(0, -1);//normally an outpipe
 }
Beispiel #9
0
        public Game1()
        {
            _graphics             = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            ContentLoad           = Content;
            IsMouseVisible        = true;
            Sounds = new EventSoundEffects(Content);
            MediaPlayer.IsRepeating = true;

            MarioGame1 = this;
            deadCount  = 0;
            hidden     = false;
        }
Beispiel #10
0
 public MarioEntity(Vector2 location, EventSoundEffects sounds)
 {
     Sounds          = sounds;
     WonGame         = false;
     Factory         = new MarioFactory();
     PowerState      = new MarioStandardState(this);
     ActionState     = new Idling(this);
     Facing          = true;
     Sprite          = Factory.MarioSprite(PowerState, ActionState, Facing, location);
     SpritePosition  = location;
     SpriteVelocity  = new Vector2(0, 0);
     EntityCollision = new MarioCollision(this);
     Live            = 3;
 }
Beispiel #11
0
 public BridgeBlockEntity(Vector2 loc, EventSoundEffects eventSound) : base(loc, eventSound)
 {
     Items = new Collection <Entity>
     {
         this//first is this one
     };
     Sounds  = eventSound;
     Factory = new BlockFactory();
     BState  = new BridgeBlockState(this);
     Sprite  = Factory.BuildSprite(Factory.FindType(BState), loc);
     BState.Enter(null);
     SpritePosition  = loc;
     InitialPos      = loc;
     EntityCollision = new BlockCollision(this);
 }
Beispiel #12
0
        public Level(GraphicsDeviceManager _graphics, string path, EventSoundEffects events)
        {
            Timer  = 301f;
            Sounds = events;

            Graphics = _graphics;
            Path     = path;
            using (var reader = new StreamReader(@"../../../../Levels/" + Path))
            {
                reader.ReadLine();
                string windowSize = reader.ReadLine();
                ScreenWidth  = Convert.ToInt32(windowSize.Split(',')[1]);
                ScreenHeight = Convert.ToInt32(windowSize.Split(',')[2]);
                Grid         = new UniformGrid(ScreenWidth, ScreenHeight);
                while (!reader.EndOfStream)
                {
                    AddingEntity(reader);
                }
            }
        }
Beispiel #13
0
 protected ItemEntity(Vector2 loc, EventSoundEffects sounds)
 {
 }
Beispiel #14
0
 protected BlockEntity(Vector2 loc, EventSoundEffects eventSound)
 {
     Revealable = false;
     Sounds     = eventSound;
 }