private void DrawTiles() { //Draw downtiles for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--) { for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--) { if (newTileGrid[x, y] != null) { TileDrawer.DrawTileAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y)); } } } //Drawuptiles for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--) { for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--) { if (newTileGrid[x, y] != null) { TileDrawer.DrawTileRoofingAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y)); } } } }
private async void Form1_Load(object sender, EventArgs e) { OutputBox.Text += "Starting connection..\n"; await connection.StartAsync(); OutputBox.Text += "Connection started!\n"; connection.On <string>("ReceiveUser", (user) => { this.BeginInvoke((Action)(() => { CreatePlayer(user); })); }); connection.On <string, int, int>("ReceiveCoordinate", (user, x, y) => { this.BeginInvoke((Action)(() => { if (!tanks.ContainsKey(user)) { CreatePlayer(user); } tanks[user].Location = new Point(x, y); })); }); connection.On <string>("PlayerExists", (user) => { this.BeginInvoke((Action)(() => { OutputBox.Text += $"Name {user} is currently taken!\n"; })); }); connection.On <string>("TerminatePlayer", (user) => { this.BeginInvoke((Action)(() => { OutputBox.Text += $"{user} disconnected!\n"; Button tank = tanks[user]; this.Controls.Remove(tank); tanks.Remove(user); })); }); connection.On <string>("ReceiveMaze", (maze) => { Graphics graphics = this.CreateGraphics(); TileDrawer tileDrawer = new TileDrawer(graphics, new Point(450, 30), new Size(50, 50)); WallDrawer wallDrawer = new WallDrawer(graphics, new Point(450, 30), new Size(50, 50)); List <List <MazeCellDTO> > cells = JsonSerializer.Deserialize <List <List <MazeCellDTO> > >(maze); tileDrawer.DrawTiles(cells); wallDrawer.DrawWalls(cells); }); }
private void TileDrawer_ImageEdited(object sender, EventArgs e) { short tw = TilesetControl.Tileset.TileWidth; short th = TilesetControl.Tileset.TileHeight; TilesetControl.SetImages(TileDrawer.GetImages(tw, th)); MapControl.RefreshLayers(); IsDirty = true; }
public void DrawAbove(Minijam32 game, SpriteBatch batch) { for (int x = tileGrid.GetLength(0) - 1; x >= 0; x--) { for (int y = tileGrid.GetLength(1) - 1; y >= 0; y--) { TileDrawer.DrawTileRoofingAt(batch, tileGrid[x, y].type, new Point(x, y)); } } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); TileDrawer.InitAssets(this); PlayerDrawer.InitAssets(this); EnemyDrawer.LoadAssets(this); screenPool = new ScreenPool(this); this.musicPlayer = new MusicPlayer(this); SoundPlayer.InitAssets(this); Animator.InitAssets(this); InfoDrawer.LoadAssets(this); }
public void DrawBelow(Minijam32 game, SpriteBatch batch) { //Tiles for (int x = tileGrid.GetLength(0) - 1; x >= 0; x--) { for (int y = tileGrid.GetLength(1) - 1; y >= 0; y--) { TileDrawer.DrawTileAt(batch, tileGrid[x, y].type, new Point(x, y)); } } //Bombs foreach (var location in this.plantedBombs.Keys) { int bombFuseCh = (int)(this.plantedBombs[location]); if (bombFuseCh > 1000) { if ((bombFuseCh / 100) % 5 == 0) { TileDrawer.DrawTileAt(batch, TileData.Type.BombOne, location); } else { TileDrawer.DrawTileAt(batch, TileData.Type.BombTwo, location); } } else { if ((bombFuseCh / 100) % 2 == 0) { TileDrawer.DrawTileAt(batch, TileData.Type.BombOne, location); } else { TileDrawer.DrawTileAt(batch, TileData.Type.BombTwo, location); } } } //Enemies foreach (var enemy in this.enemies) { EnemyDrawer.DrawThisTypeAt(batch, enemy); } }
public void LoadContent(ContentManager contentManager) { tiles = new TileDrawer(contentManager.Load <Texture2D>("tiles")); for (int i = 81; i < 96; i++) { var anim = new AnimatedTileDrawer(tiles, i, 16, 4); foreach (var id in anim.FrameIndex) { animatedTiles.Add(id, anim); } } for (int i = 145; i < 160; i++) { var anim = new AnimatedTileDrawer(tiles, i, 16, 4); foreach (var id in anim.FrameIndex) { animatedTiles.Add(id, anim); } } _spriteLayer.LoadContent(contentManager); }
static public void DrawCurrentState(SpriteBatch batch, Point tilePos) { //State is literally draw state, so it makes sense to put & update it right on draw cycles UpdateCurrentState(); if (!PlayerDataManager.isDead) { //Select the correct source rect & draw it if (!isMoving) { batch.Draw ( spritesheet, new Vector2(tilePos.X * TileData.ScaledTileSize.X, tilePos.Y * TileData.ScaledTileSize.Y) + heroDrawOffset * Minijam32.Scale, stateSourceRect[currentState], Color.White, 0.0f, Vector2.Zero, //table of origins for walls? Minijam32.Scale, SpriteEffects.None, 0.0f ); } else { var drawPos = new Vector2(tilePos.X * TileData.ScaledTileSize.X, tilePos.Y * TileData.ScaledTileSize.Y) + animationDrawOffset; switch (currentState) { case State.FacingDownStill: movingDown.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(0, maxFrames - frameStep * ((int)currentAnimationMs / (int)oneFrameTime))); break; case State.FacingLeftStill: movingLeft.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(frameStep * ((int)currentAnimationMs / (int)oneFrameTime), 0)); break; case State.FacingRightStill: movingRight.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(maxFrames - frameStep * ((int)currentAnimationMs / (int)oneFrameTime), 0)); break; case State.FacingUpStill: movingUp.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(0, frameStep * ((int)currentAnimationMs / (int)oneFrameTime))); break; } } } else { if (currentState == State.FacingDownStill) { TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathDown, PlayerDataManager.tilePosition); } if (currentState == State.FacingLeftStill) { TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathLeft, PlayerDataManager.tilePosition); } if (currentState == State.FacingRightStill) { TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathRight, PlayerDataManager.tilePosition); } if (currentState == State.FacingUpStill) { TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathUp, PlayerDataManager.tilePosition); } } }
public void Setup() { drawer = new TileDrawer(); game = new GameFactory(Substitute.For <IDateTimeOffset>()).NewGame("Player"); }
private void DrawTileInHand() { TileDrawer.DrawTileAt(spriteBatch, tileInHand, currentTile); }