Esempio n. 1
0
        Texture2D spritesheetPTR; // A pointer to the sprite sheet

        #endregion Fields

        #region Constructors

        public Tile(GameManager game, Texture2D spritesheetPTR, int value,Rectangle clip)
        {
            this.game = game;
            this.spritesheetPTR = spritesheetPTR;
            this.clip = clip;
            this.value = value;
        }
Esempio n. 2
0
        // Default Constructor
        public Entity2(GameManager game)
            : base(game)
        {
            this.game = game;
            this.spriteBatch = game.spriteBatch;
            this.camera = game.camera;

            pxlrect = new Rectangle(0, 0, 3, 3);
            whtpxl = game.Content.Load<Texture2D>("whtpxl");

            state = State.STANDING;
            direction = Direction.RIGHT;
            status = Status.INACTIVE;

            loadPhysics();
            isGravityOn = true;
            deltaX = 0.0f;
            deltaY = 0.0f;

            animationOffset = new Vector2(-33,-12);

            setAABB();

            sensorA = new Vector2(AABB.Left + 1, AABB.Bottom);
            sensorB = new Vector2(AABB.Right - 1, AABB.Bottom);
        }
Esempio n. 3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameManager game = new GameManager())
     {
         game.Run();
     }
 }
 // Default Constructor
 public KillableCreature(GameManager game)
     : base(game)
 {
     healSpeed = 500;    // These values are just so the compiler will shut up. I highly
     recoverSpeed = 20;  // recommend that you overwrite these when you extend this class.
     poisonTimer = 100;    // [NOT CURRENTLY USED]
 }
Esempio n. 5
0
        public void JumpTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            target.Jump();
            Assert.AreEqual(target.getState(), Entity.State.INAIR);
        }
Esempio n. 6
0
        public TileLayer(GameManager game, Texture2D spritesheet, int[,] tileNums)
        {
            this.game = game;
            this.spritesheetPTR = spritesheet;

            buildHeightmaps();

            tile = buildTileLayer(tileNums);
        }
Esempio n. 7
0
        public void centerPointTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            Vector2 expected = new Vector2(target.position.X + (target.rect.Width / 2), target.position.Y + (target.rect.Height / 2));
            Vector2 actual;
            actual = target.centerPoint();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 8
0
        Animation walkLeft, walkRight; // Animations

        #endregion Fields

        #region Constructors

        public Hero2(GameManager game, string ponyname)
            : base(game)
        {
            rect = new Rectangle((int)position.X, (int)position.Y, _heroWidth, _heroHeight);

            this.name = ponyname;
            this.spritesheet = game.Content.Load<Texture2D>("spritesheet_" + ponyname);

            loadHero(ponyname);
            loadAnimations();
        }
Esempio n. 9
0
        public void getStateTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            Entity.State expected = Entity.State.STANDING;
            Entity.State actual;
            actual = target.getState();
            Assert.AreEqual(expected, actual);
            expected = Entity.State.INAIR;
            Assert.AreNotEqual(expected, actual);
        }
Esempio n. 10
0
        // Default Consructor
        public Map(GameManager game, Texture2D spritesheet, string MapFileName)
        {
            this.game = game;
            this.camera = game.camera;

            this.spritesheet = spritesheet;
            loadMap(MapFileName);

            tileMapWidth = layer[collisionLayer].tile.GetLength(1);
            tileMapHeight = layer[collisionLayer].tile.GetLength(0);

            mapWidthInPixels = tileMapWidth * tileWidth;
            mapHeightInPixels = tileMapHeight * tileHeight;
        }
Esempio n. 11
0
        Animation walkLeft, walkRight; // Animations

        #endregion Fields

        #region Constructors

        public Enemy(GameManager game, string enemyname)
            : base(game)
        {
            rect = new Rectangle((int)position.X, (int)position.Y, _enemyWidth, _enemyHeight);

            this.enemyname = enemyname;
            this.spritesheet = game.Content.Load<Texture2D>("spritesheet_" + enemyname);

            loadEnemy(enemyname);
            loadAnimations();
            setCollisionOffsets();

            this.status = Status.ACTIVE;
        }
Esempio n. 12
0
        // Default Constructor
        public Level(GameManager game, string LevelNumber)
            : base(game, game.spriteBatch)
        {
            this.game = game;
            this.player = game.player;
            this.camera = game.camera;

            // Loads Map
            Texture2D mapSpritesheet = game.Content.Load<Texture2D>("spritesheet_map-" + LevelNumber);
            this.map = new Map(game, mapSpritesheet, "Data\\map-" + LevelNumber + ".txt");

            // Loads Level
            loadLevel("Data\\level-" + LevelNumber + ".txt");

            Components.Add(this.player);
        }
Esempio n. 13
0
        // Default Constructor
        public Entity(GameManager game)
            : base(game)
        {
            this.game = game;
            this.spriteBatch = game.spriteBatch;
            this.camera = game.camera;

            pxlrect = new Rectangle(0, 0, 3, 3);
            whtpxl = game.Content.Load<Texture2D>("whtpxl");

            state = State.STANDING;
            direction = Direction.RIGHT;
            status = Status.INACTIVE;

            loadPhysics();
            isGravityOn = true;
            deltaX = 0.0f;
            deltaY = 0.0f;

            sensorA = botLeft;
            sensorB = botRight;

            setAABB();
        }
Esempio n. 14
0
        public void LandTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            target.Land();
            Assert.AreEqual(target.getState(), Entity.State.STANDING);
        }
Esempio n. 15
0
 // Default Constructor
 public Player(GameManager game)
     : base(game)
 {
     this.game = game;
     loadPlayer("Data\\player.txt");
 }
Esempio n. 16
0
        public void MoveRightTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            float before = target.DeltaX;
            target.MoveRight();
            Assert.AreEqual(target.DeltaX, before + Physics.xAcceleration);
        }
Esempio n. 17
0
        public void placeTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            Vector2 location = new Vector2();
            target.place(location);
            Assert.AreEqual(target.position,location);
        }
Esempio n. 18
0
        public void MoveUpTest()
        {
            GameManager game = new GameManager();
            Entity target = new Entity(game);

            float before = target.DeltaY;
            target.MoveUp();
            Assert.AreEqual(target.DeltaY, before - Physics.yAcceleration);
        }