Esempio n. 1
0
 public Game()
 {
     player = new Entity(64 * 3, 64 * 16, 32, 32, 63);
     target = new Target(64, 64);
     target.ID = 46;
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferredBackBufferWidth = (800 / 16) * 16;
     graphics.PreferredBackBufferHeight = (600 / 16) * 16;
     graphics.ApplyChanges();
     Content.RootDirectory = "Content";
     instructions = "    You are a contract scarer, similiar to a contract killer, you scare people\n" +
                    "for money. You must adjust your scariness for each target or else you\n" +
                    "may scare them too much or not enough, adjust your scariness\n" +
                    "levels at the bottom left. The amount needed to scare them depends on \n" +
                    "thier age and gender: women, children, and the eldery scare more easily. \n" +
                    "By the way you are wanted by the police so make sure to watch out for\n" +
                    "them. You are given information about each target which appears\n" +
                    "in the upper right hand corner. The controls are very simple: W,A,S,D\n" +
                    "for movement and E to scare once you are near you're target.\n" +
                    "Good Luck :)";
 }
Esempio n. 2
0
        public void LoadMap(int i)
        {
            if (points > bestScore) bestScore = points;
            points = 0;
            playerFailed = false;
            string[] mapData = File.ReadAllLines("Content/Maps/Map" + i + ".map");
            foreach (string blockData in mapData)
            {
                try
                {
                    string[] properties = blockData.Split(',');
                    int x = Convert.ToInt32(properties[0]);
                    int y = Convert.ToInt32(properties[1]);
                    int ID = Convert.ToInt32(properties[2]);
                    bool hasPhysics = ID > 15;
                    tiles.Add(new Tile(x, y, ID, hasPhysics));
                }
                catch
                {

                }
            }
            entities.Clear();
            target = new Target(rand.Next(2, 15) * 64, rand.Next(2, 14) * 64);
            entities.Add(player);
            player.x = 64 * 3;
            player.y = 64 * 4;
            offset = new Vector2((((800 / 16) * 16) / 2) - (64 * 3), (((600 / 16) * 16) / 2) - (64 * 4));
            entities.Add(target);
            for (int it = 0; it < 32; it++)
            {
                entities.Add(new Entity(rand.Next(2, 15) * 64, rand.Next(2, 14) * 64, 32, 32, rand.Next(56, 63)));
            }
        }
Esempio n. 3
0
        public void Scare()
        {
            if (Math.Sqrt(Math.Pow(player.x - target.x, 2) + Math.Pow(player.y - target.y, 2)) < 64)
            {
                if (Math.Abs((frightness.percentFull / 10) - target.fear) > 2)
                {
                    playerFailed = true;
                    if ((frightness.percentFull / 10) < target.fear)
                    {
                        reasonForFailure = "Not Scary Enough! Target was unnerved";
                    }
                    else
                    {
                        reasonForFailure = "Too Scary! Target had a heart attack";
                    }
                }

                if (!playerFailed)
                {
                    notifications.Add(new Notification(target.x, target.y, "+" + target.worth));
                    points += target.worth;
                }
                entities.Remove(target);
                target = new Target(rand.Next(2, 15) * 64, rand.Next(2, 14) * 64);
                entities.Add(target);
            }
        }