Skip to content

Commit

Permalink
Merge pull request #10 from Imaginos16/epic
Browse files Browse the repository at this point in the history
Fixes Block Placement Preview
  • Loading branch information
MarkSuckerberg authored Aug 29, 2023
2 parents a714c3a + 02d8803 commit 11a6656
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Blocktest/Code/Blocks/WhiteSand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Blocktest.Blocks
{
public class WhiteSand : Block
{
public override void Initialize()
{
blockName = "White Sand";
blockID = 16;
blockSmoothing = true;
base.Initialize();
}
}
}
7 changes: 7 additions & 0 deletions Blocktest/Code/Scenes/GameScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ public void Draw(GameTime gameTime, GraphicsDevice graphicsDevice) {
_spriteBatch.Begin();
Globals.BackgroundTilemap.Draw(_spriteBatch);
Globals.ForegroundTilemap.Draw(_spriteBatch);
// placement preview
if (buildMode)
_spriteBatch.Draw(BlockManager.AllBlocks[blockSelected].blockSprite.Texture,
new Vector2Int(Mouse.GetState().X - (Mouse.GetState().X % 8),
(Mouse.GetState().Y - Mouse.GetState().Y % 8)),
new Rectangle(1, 1, 10, 10), Color.DimGray);

_spriteBatch.End();
}

Expand Down
Binary file added Blocktest/Content/Graphics/Blocks/whitesand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 11a6656

Please sign in to comment.