diff --git a/Collector.sln.DotSettings.user b/Collector.sln.DotSettings.user new file mode 100644 index 0000000..5af94cd --- /dev/null +++ b/Collector.sln.DotSettings.user @@ -0,0 +1,4 @@ + + True + True + True \ No newline at end of file diff --git a/Collector/Collector.csproj b/Collector/Collector.csproj index a68146c..49d6549 100644 --- a/Collector/Collector.csproj +++ b/Collector/Collector.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.2 + netcoreapp3.1 latest diff --git a/Collector/Content/Content.mgcb b/Collector/Content/Content.mgcb index ddc4c36..62e11c6 100644 --- a/Collector/Content/Content.mgcb +++ b/Collector/Content/Content.mgcb @@ -13,3 +13,159 @@ #---------------------------------- Content ---------------------------------# +#begin air.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:air.png + +#begin crosshair.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:crosshair.png + +#begin grass.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:grass.png + +#begin jungleGrass.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:jungleGrass.png + +#begin man.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:man.png + +#begin roof.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:roof.png + +#begin sand.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:sand.png + +#begin snow.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:snow.png + +#begin stone.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:stone.png + +#begin tree.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:tree.png + +#begin wall.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:wall.png + +#begin water.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:water.png + +#begin wood.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:wood.png + diff --git a/Collector/Content/air.png b/Collector/Content/air.png new file mode 100644 index 0000000..22d5f8a Binary files /dev/null and b/Collector/Content/air.png differ diff --git a/Collector/Content/crosshair.png b/Collector/Content/crosshair.png new file mode 100644 index 0000000..5635c25 Binary files /dev/null and b/Collector/Content/crosshair.png differ diff --git a/Collector/Content/grass.png b/Collector/Content/grass.png new file mode 100644 index 0000000..a554e52 Binary files /dev/null and b/Collector/Content/grass.png differ diff --git a/Collector/Content/jungleGrass.png b/Collector/Content/jungleGrass.png new file mode 100644 index 0000000..ecff7a2 Binary files /dev/null and b/Collector/Content/jungleGrass.png differ diff --git a/Collector/Content/man.png b/Collector/Content/man.png new file mode 100644 index 0000000..aa2beb9 Binary files /dev/null and b/Collector/Content/man.png differ diff --git a/Collector/Content/roof.png b/Collector/Content/roof.png new file mode 100644 index 0000000..21534ab Binary files /dev/null and b/Collector/Content/roof.png differ diff --git a/Collector/Content/sand.png b/Collector/Content/sand.png new file mode 100644 index 0000000..3d354ca Binary files /dev/null and b/Collector/Content/sand.png differ diff --git a/Collector/Content/snow.png b/Collector/Content/snow.png new file mode 100644 index 0000000..0100539 Binary files /dev/null and b/Collector/Content/snow.png differ diff --git a/Collector/Content/stone.png b/Collector/Content/stone.png new file mode 100644 index 0000000..7e65b12 Binary files /dev/null and b/Collector/Content/stone.png differ diff --git a/Collector/Content/tree.png b/Collector/Content/tree.png new file mode 100644 index 0000000..0ac38ed Binary files /dev/null and b/Collector/Content/tree.png differ diff --git a/Collector/Content/wall.png b/Collector/Content/wall.png new file mode 100644 index 0000000..df0596d Binary files /dev/null and b/Collector/Content/wall.png differ diff --git a/Collector/Content/water.png b/Collector/Content/water.png new file mode 100644 index 0000000..8a04451 Binary files /dev/null and b/Collector/Content/water.png differ diff --git a/Collector/Content/wood.png b/Collector/Content/wood.png new file mode 100644 index 0000000..ec7e94c Binary files /dev/null and b/Collector/Content/wood.png differ diff --git a/Collector/Main.cs b/Collector/Main.cs index 6669b6e..58938b2 100644 --- a/Collector/Main.cs +++ b/Collector/Main.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using Collector.Dimension; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; @@ -6,48 +7,47 @@ namespace Collector { public class Main : Game { - GraphicsDeviceManager graphics; - SpriteBatch spriteBatch; - + private GraphicsDeviceManager _graphics; + private SpriteBatch _spriteBatch; + private InputController _inputController; + public Main() { - graphics = new GraphicsDeviceManager(this); + _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void Initialize() - { - // TODO: Add your initialization logic here + {// TODO: Add your initialization logic here + base.Initialize(); } protected override void LoadContent() - { - spriteBatch = new SpriteBatch(GraphicsDevice); - - // TODO: use this.Content to load your game content here + {// TODO: use this.Content to load your game content here + _spriteBatch = new SpriteBatch(GraphicsDevice); + BlockMaterials.LoadContent(Content); } - + protected override void Update(GameTime gameTime) - { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || - Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - - // TODO: Add your update logic here - + {// TODO: Add your update logic here/* + _inputController.PlayerInput(); base.Update(gameTime); } + + protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here - base.Draw(gameTime); + _spriteBatch.Begin(); + BlockMaterials.Draw("grass",_spriteBatch,0,0); + _spriteBatch.End(); } } } \ No newline at end of file diff --git a/Collector/OLD/Assets/air.png b/Collector/OLD/Assets/air.png new file mode 100644 index 0000000..22d5f8a Binary files /dev/null and b/Collector/OLD/Assets/air.png differ diff --git a/Collector/OLD/Assets/crosshair.png b/Collector/OLD/Assets/crosshair.png new file mode 100644 index 0000000..5635c25 Binary files /dev/null and b/Collector/OLD/Assets/crosshair.png differ diff --git a/Collector/OLD/Assets/grass.png b/Collector/OLD/Assets/grass.png new file mode 100644 index 0000000..a554e52 Binary files /dev/null and b/Collector/OLD/Assets/grass.png differ diff --git a/Collector/OLD/Assets/jungleGrass.png b/Collector/OLD/Assets/jungleGrass.png new file mode 100644 index 0000000..ecff7a2 Binary files /dev/null and b/Collector/OLD/Assets/jungleGrass.png differ diff --git a/Collector/OLD/Assets/man.png b/Collector/OLD/Assets/man.png new file mode 100644 index 0000000..aa2beb9 Binary files /dev/null and b/Collector/OLD/Assets/man.png differ diff --git a/Collector/OLD/Assets/roof.png b/Collector/OLD/Assets/roof.png new file mode 100644 index 0000000..21534ab Binary files /dev/null and b/Collector/OLD/Assets/roof.png differ diff --git a/Collector/OLD/Assets/sand.png b/Collector/OLD/Assets/sand.png new file mode 100644 index 0000000..3d354ca Binary files /dev/null and b/Collector/OLD/Assets/sand.png differ diff --git a/Collector/OLD/Assets/snow.png b/Collector/OLD/Assets/snow.png new file mode 100644 index 0000000..0100539 Binary files /dev/null and b/Collector/OLD/Assets/snow.png differ diff --git a/Collector/OLD/Assets/stone.png b/Collector/OLD/Assets/stone.png new file mode 100644 index 0000000..7e65b12 Binary files /dev/null and b/Collector/OLD/Assets/stone.png differ diff --git a/Collector/OLD/Assets/tree.png b/Collector/OLD/Assets/tree.png new file mode 100644 index 0000000..0ac38ed Binary files /dev/null and b/Collector/OLD/Assets/tree.png differ diff --git a/Collector/OLD/Assets/wall.png b/Collector/OLD/Assets/wall.png new file mode 100644 index 0000000..df0596d Binary files /dev/null and b/Collector/OLD/Assets/wall.png differ diff --git a/Collector/OLD/Assets/water.png b/Collector/OLD/Assets/water.png new file mode 100644 index 0000000..8a04451 Binary files /dev/null and b/Collector/OLD/Assets/water.png differ diff --git a/Collector/OLD/Assets/wood.png b/Collector/OLD/Assets/wood.png new file mode 100644 index 0000000..ec7e94c Binary files /dev/null and b/Collector/OLD/Assets/wood.png differ diff --git a/Collector/src/Character/InputController.cs b/Collector/src/Character/InputController.cs new file mode 100644 index 0000000..1c45df1 --- /dev/null +++ b/Collector/src/Character/InputController.cs @@ -0,0 +1,142 @@ +using System.Collections.Generic; +using Collector; +using Collector.Dimension; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +public class InputController : IRestrictions { + + private Player player; + private Mouse mouse; + //private Dictionary> animations; + int i = 0; + + public InputController(Player player, Mouse mouse) + { + this.player = player; + this.mouse = mouse; + } + + public InputController() { + + /* + animations = new HashMap<>(); + animations.put("Up", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Up"))); + animations.put("UpRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpRight"))); + animations.put("UpLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpLeft"))); + animations.put("Down", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Down"))); + animations.put("DownRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownRight"))); + animations.put("DownLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownLeft"))); + animations.put("Left", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Left"))); + animations.put("Right", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Right"))); + */ + } + + private void PlayerInput() + { + if (Keyboard.GetState().IsKeyDown(Keys.Escape)) + { + Exit(); + } + else if(Keyboard.GetState().IsKeyDown(Keys.W)) + { + + } + else if(Keyboard.GetState().IsKeyDown(Keys.A)) + { + + } + else if(Keyboard.GetState().IsKeyDown(Keys.S)) + { + + } + else if(Keyboard.GetState().IsKeyDown(Keys.D)) + { + + } + } + + /* + +public void handleInput() { + i++; + if (Gdx.input.isKeyPressed(Input.Keys.Q)) { + Main.cam.zoom += 5; + } + if (Gdx.input.isKeyPressed(Input.Keys.E)) { + Main.cam.zoom -= 5; + } + if ((Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT) )&& i > KEY_DELAY) { + Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); + Main.cam.unproject(mousePos); + int x = mouse.getSelectedX(mousePos) >> TILE_SHIFT; + int y = mouse.getSelectedY(mousePos) >> TILE_SHIFT; + if(Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) { + i = 0; + Chunks.placeBlock(x, y, "wood"); + } + if (Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) { + i = 0; + Chunks.removeBlock(x,y); + } + } + + if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("UpLeft")); + Player.addX(-MOVEMENT_SPEED); + Player.addY(MOVEMENT_SPEED); + Main.cam.translate(-MOVEMENT_SPEED, MOVEMENT_SPEED); + } + else if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("UpRight")); + Player.addX(MOVEMENT_SPEED); + Player.addY(MOVEMENT_SPEED); + Main.cam.translate(MOVEMENT_SPEED, MOVEMENT_SPEED); + } + else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("DownLeft")); + Player.addX(-MOVEMENT_SPEED); + Player.addY(-MOVEMENT_SPEED); + Main.cam.translate(-MOVEMENT_SPEED, -MOVEMENT_SPEED); + } + else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("DownRight")); + Player.addX(MOVEMENT_SPEED); + Player.addY(-MOVEMENT_SPEED); + + Main.cam.translate(MOVEMENT_SPEED, -MOVEMENT_SPEED); + } + else if (Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("Left")); + Player.addX(-MOVEMENT_SPEED); + Main.cam.translate(-MOVEMENT_SPEED, 0); + } + else if (Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("Right")); + Player.addX(MOVEMENT_SPEED); + Main.cam.translate(MOVEMENT_SPEED, 0); + } + else if (Gdx.input.isKeyPressed(Input.Keys.S) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("Down")); + Player.addY(-MOVEMENT_SPEED); + Main.cam.translate(0, -MOVEMENT_SPEED); + } + if (Gdx.input.isKeyPressed(Input.Keys.W) && i > KEY_DELAY) { + i = 0; + player.setAnimation(animations.get("Up")); + Player.addY(MOVEMENT_SPEED); + Main.cam.translate(0, MOVEMENT_SPEED); + } + Main.cam.update(); + + } + */ + +} diff --git a/Collector/src/Character/InputController.java b/Collector/src/Character/InputController.java deleted file mode 100644 index 7e5d613..0000000 --- a/Collector/src/Character/InputController.java +++ /dev/null @@ -1,113 +0,0 @@ -package Collector.Character; - -import Collector.Main; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input; -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.math.Vector3; -import Collector.Dimension.Chunks; -import Collector.Restrictions; - -import java.util.HashMap; - -public class InputController implements Restrictions { - - private Player player; - private HashMap> animations; - private Mouse mouse; - int i = 0; - - public InputController(Player player, Mouse mouse) { - this.player = player; - this.mouse = mouse; - animations = new HashMap<>(); - animations.put("Up", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Up"))); - animations.put("UpRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpRight"))); - animations.put("UpLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpLeft"))); - animations.put("Down", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Down"))); - animations.put("DownRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownRight"))); - animations.put("DownLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownLeft"))); - animations.put("Left", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Left"))); - animations.put("Right", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Right"))); - } - - public void handleInput() { - i++; - if (Gdx.input.isKeyPressed(Input.Keys.Q)) { - Main.cam.zoom += 5; - } - if (Gdx.input.isKeyPressed(Input.Keys.E)) { - Main.cam.zoom -= 5; - } - if ((Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT) )&& i > KEY_DELAY) { - Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); - Main.cam.unproject(mousePos); - int x = mouse.getSelectedX(mousePos) >> TILE_SHIFT; - int y = mouse.getSelectedY(mousePos) >> TILE_SHIFT; - if(Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) { - i = 0; - Chunks.placeBlock(x, y, "wood"); - } - if (Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) { - i = 0; - Chunks.removeBlock(x,y); - } - } - - if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("UpLeft")); - Player.addX(-MOVEMENT_SPEED); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("UpRight")); - Player.addX(MOVEMENT_SPEED); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(MOVEMENT_SPEED, MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("DownLeft")); - Player.addX(-MOVEMENT_SPEED); - Player.addY(-MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, -MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("DownRight")); - Player.addX(MOVEMENT_SPEED); - Player.addY(-MOVEMENT_SPEED); - - Main.cam.translate(MOVEMENT_SPEED, -MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Left")); - Player.addX(-MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, 0); - } - else if (Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Right")); - Player.addX(MOVEMENT_SPEED); - Main.cam.translate(MOVEMENT_SPEED, 0); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Down")); - Player.addY(-MOVEMENT_SPEED); - Main.cam.translate(0, -MOVEMENT_SPEED); - } - if (Gdx.input.isKeyPressed(Input.Keys.W) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Up")); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(0, MOVEMENT_SPEED); - } - Main.cam.update(); - } -} diff --git a/Collector/src/Character/Mouse.java b/Collector/src/Character/Mouse.cs similarity index 100% rename from Collector/src/Character/Mouse.java rename to Collector/src/Character/Mouse.cs diff --git a/Collector/src/Character/Player.cs b/Collector/src/Character/Player.cs index e8daa86..eb04caa 100644 --- a/Collector/src/Character/Player.cs +++ b/Collector/src/Character/Player.cs @@ -3,15 +3,13 @@ using Collector; public class Player : IRestrictions { private static int X; private static int Y; - //private string SpriteName; - //private TextureAtlas textureAtlas; - //private Animation animation; + private string SpriteName; private Inventory playerInventory; public Player(int x, int y) { //Player location - Player.X = x< Materials = new Dictionary(); - //public static Dictionary Textures = new Dictionary<>(); + public static Dictionary Textures = new Dictionary(); //Private so the singleton can't be instantiated - private BlockMaterials() {} + internal BlockMaterials() {} - public static void create(){ + public static void LoadContent(ContentManager content){ Materials.Add("grass",new Block("grass")); Materials.Add("wood",new Block("wood")); Materials.Add("water",new Block("water")); @@ -18,11 +22,16 @@ namespace Collector.Dimension Materials.Add("air",new Block("air")); Materials.Add("roof",new Block("roof")); Materials.Add("wall",new Block("wall")); - /* - for (String s:BlockMaterials.Materials.keySet()) { - Textures.Add(s,new Texture("assets/" + s + ".png")); + + foreach (var name in Materials.Keys) + { + Textures.Add(name,content.Load(name)); + } } - */ + + public static void Draw(string name,SpriteBatch _spriteBatch,int x, int y) + { + _spriteBatch.Draw(Textures[name],new Vector2(x, y),Color.Aqua); } } } diff --git a/Collector/src/Dimension/WorldRenderer.cs b/Collector/src/Dimension/WorldRenderer.cs index b0b191d..2690a5a 100644 --- a/Collector/src/Dimension/WorldRenderer.cs +++ b/Collector/src/Dimension/WorldRenderer.cs @@ -5,7 +5,7 @@ namespace Collector.Dimension public class WorldRenderer : IRestrictions { //private Mouse mouse; //private InputController inputController; - private Player _player; + //private Player _player; /* public WorldRenderer(InputController inputController, Mouse mouse, Player player) {