Made a Gui and created a dropdown menu to select block

This commit is contained in:
2020-06-28 06:14:14 -06:00
parent b6f39d8f12
commit a2ca087156
594 changed files with 6768 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ namespace Collector.Character
{
public class Collision
{
public RectangleF Rectangle { get; private set; }
public RectangleF Rectangle { get; }
public Collision(int x, int y)
{

View File

@@ -166,10 +166,15 @@ namespace Collector.Character
}
if (mouseState.RightButton == ButtonState.Pressed)
{
Chunks.PlaceBlock(PlayerMouse.GetSelectedX(),PlayerMouse.GetSelectedY(),Blocks.BlockWood);
PlaceSelectedBlock(Inventory.GetSelectedItem());
}
}
private static void PlaceSelectedBlock(Blocks selectedItem)
{
Chunks.PlaceBlock(PlayerMouse.GetSelectedX(), PlayerMouse.GetSelectedY(), selectedItem);
}
private void UpdateAnimationFrame(GameTime gameTime)
{
_timeSinceLastFrame += gameTime.GetElapsedSeconds();

View File

@@ -1,8 +1,15 @@
using System.Collections.Generic;
using Collector.Dimension;
using Collector.UI;
using Myra.Graphics2D.UI;
public class Inventory {
private LinkedList<ItemStack> inventory = new LinkedList<ItemStack>();
public static Blocks GetSelectedItem()
{
return (Blocks) Gui._combo.SelectedIndex.Value;
}
public LinkedList<ItemStack> GetInventory() {
return inventory;