public void checkArea(Point point, PlayerTest player) { Rectangle bounding = new Rectangle(Convert.ToInt32(room.pos.X) + 50, Convert.ToInt32(room.pos.Y), 75, 200); if (player.bounding.Intersects(bounding)) { player.room = this.room; } }
public bool testRight(PlayerTest player) { if (two.Test(player, 1, this) && four.Test(player, 2, this)) { return(true); } else { return(false); } }
public bool testLeft(PlayerTest player) { if (ten.Test(player, 5, this) && eight.Test(player, 4, this)) { return true; } else { return false; } }
public bool testDown(PlayerTest player) { if (six.Test(player, 3, this) && four.Test(player, 2, this) && eight.Test(player, 4, this)) { return true; } else { return false; } }
public bool testUp(PlayerTest player) { if (twelve.Test(player, 0, this) && two.Test(player, 1, this) && ten.Test(player, 5, this)) { return(true); } else { return(false); } }
public bool testDown(PlayerTest player) { if (six.Test(player, 3, this) && four.Test(player, 2, this) && eight.Test(player, 4, this)) { return(true); } else { return(false); } }
public bool testLeft(PlayerTest player) { if (ten.Test(player, 5, this) && eight.Test(player, 4, this)) { return(true); } else { return(false); } }
public bool Test(PlayerTest player, int num, Hexagon hex) { bool temp = true; if (hex.room.Connections[num]) { foreach (Vector2 v in ints) { if (new Rectangle(player.bounding.X, player.bounding.Y, 1, 1).Contains(new Rectangle(Convert.ToInt32(v.X), Convert.ToInt32(v.Y), 1, 1))) { temp = false; } } } return(temp); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Define all variables not defined in Initizalize doors = new bool[] { true, false, true, true, false, false }; gamestate = GameState.Menu; menuTex = Content.Load <Texture2D>("MenuScreen1"); createMap(); startGame = new Button(530, 480, 405, 150); playerTex = Content.Load <Texture2D>("Player"); player = new PlayerTest(nodes[0], new Rectangle((graphics.GraphicsDevice.Viewport.Width / 2) - (playerTex.Width / 2), 100, 50, 50), play); play = new Player(player, 3, 0); twelve = Content.Load <Texture2D>("0"); two = Content.Load <Texture2D>("1"); four = Content.Load <Texture2D>("2"); six = Content.Load <Texture2D>("3"); eight = Content.Load <Texture2D>("4"); ten = Content.Load <Texture2D>("5"); lineTest = Content.Load <Texture2D>("LineTest"); //Load Content caveTex = Content.Load <Texture2D>("Cave"); edge = Content.Load <Texture2D>("ViewportEdge"); inventoryBackground = Content.Load <Texture2D>("InventoryBackground"); trivia = new Trivia(); tQuestion = new TriviaQuestion("", 0); tAnswerA = new TriviaAnswer("", 1); tAnswerB = new TriviaAnswer("", 2); tAnswerC = new TriviaAnswer("", 3); tAnswerD = new TriviaAnswer("", 4); spriteFont = Content.Load <SpriteFont>("SpriteFont1"); UIFont = Content.Load <SpriteFont>("UIFont"); oldState = Keyboard.GetState(); dummyTexture = new Texture2D(GraphicsDevice, 1, 1); //Creates a dummy texture to make solid black rectangles dummyTexture.SetData(new Color[] { Color.Black }); caveCover = Content.Load <Texture2D>("Cover"); gamestate = GameState.Menu; //Starts game on menu newPos = new Vector2(player.bounding.Center.X, player.bounding.Center.Y); player.targetRoom = nodes[4]; highScore = new HighScore(0, 0, 0); soup = Content.Load <Texture2D>("soup"); player.items.Add(new Item("Bowl of Soup", "Warm and thick, just like mom used to make...", soup, new Rectangle(700, 600, 100, 150), 0)); double hypotinuse = Math.Sqrt(Math.Pow((player.bounding.Center.X - newPos.X), 2) + Math.Pow((player.bounding.Center.Y - newPos.Y + 16), 2)); newPos = new Vector2(player.targetRoom.pos.X + 100, player.targetRoom.pos.Y + 100); speed = new Vector2(Convert.ToSingle((player.bounding.Center.X - newPos.X) / hypotinuse), Convert.ToSingle((player.bounding.Center.Y - newPos.Y) / hypotinuse)); }
public Player(PlayerTest test, int arrows, int gold) { Location = test.room; Arrows = arrows; Gold = gold; }
public void Update(PlayerTest test) { Location = test.room; }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Define all variables not defined in Initizalize doors = new bool[] { true, false, true, true, false, false }; gamestate = GameState.Menu; menuTex = Content.Load<Texture2D>("MenuScreen1"); createMap(); startGame = new Button(530, 480, 405, 150); playerTex = Content.Load<Texture2D>("Player"); player = new PlayerTest(nodes[0], new Rectangle((graphics.GraphicsDevice.Viewport.Width / 2) - (playerTex.Width / 2), 100, 50, 50), play); play = new Player(player, 3, 0); twelve = Content.Load<Texture2D>("0"); two = Content.Load<Texture2D>("1"); four = Content.Load<Texture2D>("2"); six = Content.Load<Texture2D>("3"); eight = Content.Load<Texture2D>("4"); ten = Content.Load<Texture2D>("5"); lineTest = Content.Load<Texture2D>("LineTest"); //Load Content caveTex = Content.Load<Texture2D>("Cave"); edge = Content.Load<Texture2D>("ViewportEdge"); inventoryBackground = Content.Load<Texture2D>("InventoryBackground"); trivia = new Trivia(); tQuestion = new TriviaQuestion("", 0); tAnswerA = new TriviaAnswer("", 1); tAnswerB = new TriviaAnswer("", 2); tAnswerC = new TriviaAnswer("", 3); tAnswerD = new TriviaAnswer("", 4); spriteFont = Content.Load<SpriteFont>("SpriteFont1"); UIFont = Content.Load<SpriteFont>("UIFont"); oldState = Keyboard.GetState(); dummyTexture = new Texture2D(GraphicsDevice, 1, 1); //Creates a dummy texture to make solid black rectangles dummyTexture.SetData(new Color[] { Color.Black }); caveCover = Content.Load<Texture2D>("Cover"); gamestate = GameState.Menu; //Starts game on menu newPos = new Vector2(player.bounding.Center.X, player.bounding.Center.Y ); player.targetRoom = nodes[4]; highScore = new HighScore(0, 0, 0); soup = Content.Load<Texture2D>("soup"); player.items.Add(new Item("Bowl of Soup", "Warm and thick, just like mom used to make...", soup, new Rectangle(700, 600, 100, 150), 0)); double hypotinuse = Math.Sqrt(Math.Pow((player.bounding.Center.X - newPos.X), 2) + Math.Pow((player.bounding.Center.Y - newPos.Y + 16), 2)); newPos = new Vector2(player.targetRoom.pos.X + 100, player.targetRoom.pos.Y + 100); speed = new Vector2(Convert.ToSingle((player.bounding.Center.X - newPos.X) / hypotinuse), Convert.ToSingle((player.bounding.Center.Y - newPos.Y) / hypotinuse)); }
public bool testUp(PlayerTest player) { if (twelve.Test(player, 0, this) && two.Test(player, 1, this) && ten.Test(player, 5, this)) { return true; } else { return false; } }
public bool Test(PlayerTest player, int num, Hexagon hex) { bool temp = true; if (hex.room.Connections[num]) { foreach (Vector2 v in ints) { if (new Rectangle(player.bounding.X, player.bounding.Y, 1, 1).Contains(new Rectangle(Convert.ToInt32(v.X), Convert.ToInt32(v.Y), 1, 1))) { temp = false; } } } return temp; }
public bool testRight(PlayerTest player) { if (two.Test(player, 1, this) && four.Test(player, 2, this)) { return true; } else { return false; } }