public EntityManager(SaveData data) { player = new Player(data.Name, new Vector2(0, 0)); pathFinder = new Pathfinder(LevelManager.GetCurrentLevel()); bounds = new DrawableRectangle(ProjectData.Graphics.GraphicsDevice, new Vector2(32, 32), Color.Red, true); }
protected override void SetTexture() { var tex = new DrawableRectangle(Game1.graphics.GraphicsDevice, new Vector2(1280, 10), Color.White, true).Texture; sprite = new Image(tex); width = tex.Width; height = tex.Height; }
protected override void LoadContent() { rect = new DrawableRectangle(GameRef.GraphicsDevice, new Vector2(32, 64), Color.White, true); circ = new DrawableCircle(GameRef.GraphicsDevice, 16, Color.MediumVioletRed, true); levelManager = new LevelManager(); base.LoadContent(); }
public TextBox(GraphicsDevice graphics) { Size = Vector2.One; Font = SpriteFont; flashColor = Color.Transparent; cur = new DrawableRectangle(graphics, new Vector2(64, 64), Color.White, true); cursor = cur.Texture; }
public TextBox(GraphicsDevice graphics) { Width = 1; Height = 1; Font = SpriteFont; flashColor = Color.Transparent; backColor = Color.Transparent; foreColor = Color.White; cur = new DrawableRectangle(graphics, new Vector2(6, 64), Color.White, true); cursor = cur.Texture; }
private void Initialize(int width = 0, int height = 0) { var plainTexture = new DrawableRectangle(ProjectData.GraphicsDevice, new Vector2(48, 48), Color.White, true); AIR_TILE = new Tile(plainTexture.Texture, 48, 48, false, false, "air", Color.CornflowerBlue); FLOOR_TILE = new Tile(plainTexture.Texture, 48, 48, true, false, "floor", Color.GreenYellow); BLOCK_TILE = new Tile(plainTexture.Texture, 48, 48, true, false, "block", Color.LightGray); tileList.Add(AIR_TILE); tileList.Add(FLOOR_TILE); tileList.Add(BLOCK_TILE); testPlatforms.Add(new MovingPlatform(new Point(0, 4), new Point(3, 1), 4, MovementType.HORIZONTAL_RIGHT)); testPlatforms.Add(new MovingPlatform(new Point(3, 6), new Point(3, 1), 4, MovementType.HORIZONTAL_LEFT)); testPlatforms.Add(new MovingPlatform(new Point(8, 4), new Point(3, 1), 2, MovementType.VERTICAL_DOWN)); testPlatforms.Add(new MovingPlatform(new Point(12, 4), new Point(3, 1), 2, MovementType.VERTICAL_UP)); testPlatforms.Add(new StaticPlatform(new Point(16, 4), new Point(3, 1))); if (width == 0 | height == 0) return; tiles = new Tile[WidthInTiles, HeightInTiles]; // Default map creation for (int x = 0; x < WidthInTiles; x++) { for (int y = 0; y < HeightInTiles; y++) { tiles[x, y] = AIR_TILE; if (y == ProjectData.GAMEHEIGHT / tileHeight - 1) tiles[x, y] = FLOOR_TILE; } } }
public void LoadContent() { background = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(32, 32), Color.White, true).Texture; border = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(CANVAS_WIDTH, CANVAS_HEIGHT), Color.White, false); font = gameRef.Content.Load<SpriteFont>(@"Fonts\main_font"); playerSpawnTex = gameRef.Content.Load<Texture2D>("Images/player_spawn"); }
public Player(PlayerIndex playerIndex) : base(Vector2.Zero) { this.playerIndex = playerIndex; // Initialize the player based on playerIndex // --------------------------------------------------------------- // I seperate the initialization of players into two if statements: // PlayerIndex.One and PlayerIndex.Two. As of right now, I won't // add any more (for laziness sake) and will keep initialization // like this. I'm sorry if this code offends you. // --------------------------------------------------------------- if (playerIndex == PlayerIndex.One) { // Set the position to be on the left side of the screen Position = new Vector2(0, Game1.GAME_HEIGHT / 2 - height / 2); // Set the shooting key based on playerIndex shootingKey = Keys.Tab; // Organize the moving keys movingKeys = new Keys[4] { Keys.W, Keys.S, Keys.A, Keys.D }; // Tint is chosen from the IntroState tint = IntroState.player1Color; sprite.Tint = tint; // First player will be facing right dir = 1; flipped = false; GunOffset = new Vector2(width / 2, 0); } else if (playerIndex == PlayerIndex.Two) { // Set the position to be on the right side of the screen Position = new Vector2(Game1.GAME_WIDTH - width, Game1.GAME_HEIGHT / 2 - height / 2); // Set the shooting key based on playerIndex shootingKey = Keys.RightControl; // Organize the moving keys movingKeys = new Keys[4] { Keys.Up, Keys.Down, Keys.Left, Keys.Right }; // Tint is chosen from the IntroState tint = IntroState.player2Color; sprite.Tint = tint; // Second player will be facing left dir = -1; flipped = true; GunOffset = new Vector2(-width / 2, 0); } else { // Remember how I said I only support PlayerIndex One and Two? // This is where I kindly remind you if you forget. // ---------------------------------------------------------- throw new Exception("Unsupported PlayerIndex - please only use indeces one and two"); } // Default weapons will be Pistols. If you wanna change it, go ahead // ------------------------------------------------------------------ equippedWeapon = new Shotgun(this, shootingKey); // This font is used for the player information that is on screen // -------------------------------------------------------------- font = Game1.content.Load<SpriteFont>("defaultFont"); // And here I make the animation for the player. Easy Peasy. // --------------------------------------------------------- Texture2D[] imgs = new Texture2D[] { Game1.content.Load<Texture2D>("helicopter1"), Game1.content.Load<Texture2D>("helicopter2") }; playerAnim = new Animation(imgs, 20f); // And here I have the basic rectangles used for the life bar. // The life bar stuff is pretty basic right now // ---------------------------------------------------------- var tex = new DrawableRectangle(Game1.graphics.GraphicsDevice, new Vector2(10, 10), Color.White, true).Texture; lifeBg = tex; lifeFg = tex; // Set the force field size to be bigger than the player // ----------------------------------------------------- forceFieldWidth = width + 30; forceFieldHeight = height + 30; // Temporary setting the force field texture to a white rectangle // -------------------------------------------------------------- forceFieldTex = new DrawableRectangle(Game1.graphics.GraphicsDevice, new Vector2(forceFieldWidth, forceFieldHeight), Color.White, true).Texture; }
protected override void LoadContent() { base.LoadContent(); FadeOutRect = new DrawableRectangle(GraphicsDevice, new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), Color.Black, true); }
protected override void SetBulletTexture() { var tex = new DrawableRectangle(Game1.graphics.GraphicsDevice, new Vector2(1366, 5), Color.Red, true).Texture; bulletTex = tex; }