Пример #1
0
 public PlatformingBlockSprite(Vector2 location)
 {
     platformingBlockSpriteSheet = BlockSpriteTextureStorage.CreatePlatformingBlockSprite();
     this.location         = location;
     spriteSheetSpriteSize = platformingBlockSpriteSheet.Width;
     collisionRectangle    = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
Пример #2
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     BlockSpriteTextureStorage.Load(this.Content);
     ItemSpriteTextureStorage.Load(this.Content);
     EnemySpriteFactory.Load(this.Content);
     MiscGameObjectTextureStorage.Load(this.Content);
     MarioSpriteFactory.Load(this.Content);
     GUISpriteFactory.Load(this.Content);
     SoundEffectFactory.Load(this.Content);
     MusicFactory.Load(this.Content);
     background         = Content.Load <Texture2D>(UtilityClass.background);
     background2        = Content.Load <Texture2D>(UtilityClass.background2);
     skyworldbackground = Content.Load <Texture2D>("skyworldbackground");
     deathbackground    = Content.Load <Texture2D>(UtilityClass.deathbackground);
     font           = Content.Load <SpriteFont>(UtilityClass.FontString);
     basicarialfont = Content.Load <SpriteFont>(UtilityClass.BasicArialFontString);
     LoadKeyBoardCommands();
     levelStore       = loader.LoadLevel();
     mario            = levelStore.player;
     cameraController = new CameraController(camera, mario);
     resetCommand     = new ResetLevelCommand(this);
     MusicFactory.MainTheme();
     ResetGui();
 }
Пример #3
0
 public GroundBlockSprite(Vector2 location)
 {
     groundBlockSpriteSheet = BlockSpriteTextureStorage.CreateGroundBlockSprite();
     this.location          = location;
     spriteSheetSpriteSize  = groundBlockSpriteSheet.Width;
     collisionRectangle     = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
Пример #4
0
 public BlueBrickBlockSprite(Vector2 location)
 {
     brickBlockSpriteSheet = BlockSpriteTextureStorage.CreateBlueBrickBlockSprite();
     this.location         = location;
     frame              = UtilityClass.zero;
     totalFrames        = UtilityClass.one;
     smashed            = false;
     collisionRectangle = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
Пример #5
0
 public HiddenBlockSprite(Vector2 location)
 {
     hiddenBlockSpriteSheet = BlockSpriteTextureStorage.CreateHiddenBlockSprite();
     this.location          = location;
     frame                 = UtilityClass.zero;
     used                  = false;
     totalFrames           = UtilityClass.one;
     spriteSheetSpriteSize = hiddenBlockSpriteSheet.Width / UtilityClass.two;
     collisionRectangle    = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
 public QuestionBlockSprite(Vector2 location)
 {
     questionBlockSpriteSheet = BlockSpriteTextureStorage.CreateQuestionBlockSprite();
     this.location            = location;
     frame                 = UtilityClass.zero;
     used                  = false;
     bounce                = false;
     totalFrames           = UtilityClass.one;
     bounceTimer           = UtilityClass.BlockBounceTimer;
     spriteSheetSpriteSize = questionBlockSpriteSheet.Width / UtilityClass.two;
     minY                  = (int)location.Y;
     collisionRectangle    = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
 public BrickBlockCoinDispenserSprite(Vector2 location)
 {
     brickBlockSpriteSheet = BlockSpriteTextureStorage.CreateBrickBlockCoinDispenserSprite();
     this.location         = location;
     frame                 = UtilityClass.zero;
     totalFrames           = UtilityClass.one;
     used                  = false;
     bounce                = false;
     spriteSheetSpriteSize = brickBlockSpriteSheet.Width / UtilityClass.two;
     bounceTimer           = UtilityClass.BlockBounceTimer;
     maxHeight             = (int)location.Y - UtilityClass.ten;
     minHeight             = (int)location.Y;
     collisionRectangle    = new Rectangle((int)location.X, (int)location.Y, spriteSheetSpriteSize, spriteSheetSpriteSize);
 }
        public void questionBlockTestLeft()
        {
            bool passed = true;

            BlockSpriteTextureStorage.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(390, 400);
            IBlock            question          = new Blocks(400, 400, BlockType.Question);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), question.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Left))
            {
                Console.WriteLine("QuestionBlockTestLeft Passed");
            }
            else
            {
                Console.WriteLine("QuestionBlockTestLeft failed");
            }
        }
        public void HiddenBlockTestTop()
        {
            bool passed = true;

            BlockSpriteTextureStorage.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(400, 400);
            IBlock            hidden            = new Blocks(400, 415, BlockType.Hidden);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), hidden.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Top))
            {
                Console.WriteLine("HiddenBlockTop Test Passed");
            }
            else
            {
                Console.WriteLine("HiddenBlockTop failed");
            }
        }
        public void GroundBlockTestRight()
        {
            bool passed = true;

            BlockSpriteTextureStorage.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(410, 400);
            IBlock            ground            = new Blocks(400, 400, BlockType.Ground);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), ground.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Right))
            {
                Console.WriteLine("GroundBlockRight Test Passed");
            }
            else
            {
                Console.WriteLine("GroundBlockRight failed");
            }
        }
        public void PlatformingBlockTestBottom()
        {
            bool passed = true;

            BlockSpriteTextureStorage.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(400, 400);
            IBlock            platform          = new Blocks(400, 385, BlockType.Platforming);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), platform.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Bottom))
            {
                Console.WriteLine("PlatformBlockBottom Test Passed");
            }
            else
            {
                Console.WriteLine("PlatformBlockBottom failed");
            }
        }