コード例 #1
0
 public void PlaceObject(ref Player player, int XLocation, int YLocation)
 {
     if (XLocation <= Width && YLocation <= Height)
     {
         player.setLocation(XLocation, YLocation);
     }
     else
     {
         player.Die();
     }
 }
コード例 #2
0
        public GameState()
        {
            PlayerOne = new Player();
            WorldMap = new Map();
            EnemyOne = new Enemy();
            EnemyTwo = new Enemy();
            worldWidth = 10000;
            worldHeight = 10000;

            WorldMap.SetSize(worldWidth, worldHeight);
            PlayerOne.setLocation(worldWidth / 2, worldHeight / 2);
            EnemyOne.setLocation(worldWidth / 4, worldHeight / 4);
            EnemyTwo.setLocation(3*worldWidth / 4, 3*worldHeight / 4);
        }