From b767abb8ec2f4291aac15b0f7a46ba69b78275e3 Mon Sep 17 00:00:00 2001 From: Tolamar Date: Mon, 23 Jul 2012 18:25:32 +0200 Subject: [PATCH 1/4] Resource Folder und eine Testmap --- projects/SotF/res/map.tmx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/SotF/res/map.tmx diff --git a/projects/SotF/res/map.tmx b/projects/SotF/res/map.tmx new file mode 100644 index 0000000..52e60ba --- /dev/null +++ b/projects/SotF/res/map.tmx @@ -0,0 +1,16 @@ + + + + + + + + eJztwTEBAAAAwqD1T+1lC6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAbnEAAAQ== + + + + + eJzt2u1OwjAYBtCK3yhw/3crDTbOSke7dTL0nOSN/iCE9MmztYMQAAAAbtvdcd4+5+HKn4UQXitfd1j0U/xdL8d5b5iYx24wJYfC/4zbhq/rz5TZFN5XHtPEPHYzZlt4X3lMM5bHvjDyWI5+rIs81mWYx/BssQnT8zgEeUw1zCPtZfehvjc1eVAvzyPdr+VxHaV+PIXTdSs//8ljWaV+7MP3jFrv55Fc2sTnH/GZ4Ll+pL9z8khkUidf2/twyijurXr0I9GTOufO48N7ea9+RIds+Onc+qa9bs9+5PJsZHXym/3gslI/eu2vaHMpi9p+/OdrTE+9+nHu2r8PcmrVsx/ymG9sjfMzojyW1yOPdIZMM/w+XR5tSmucniXGeRx53dh+Sz/a1axv/n15bR60a1lneSxPP9ZFP9ZFP9Zlbhfib3+fgzx6mduPuC/O98PymM794/a03j8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBA+ADAyIHM= + + + From 38c0381c3a6913cf51363f05d8e32e3e3765260b Mon Sep 17 00:00:00 2001 From: Tolamar Date: Tue, 24 Jul 2012 09:58:30 +0200 Subject: [PATCH 2/4] World-Class und Team-class --- .../SotF/src/de/fhtrier/gdw2/sotf/IWorld.java | 4 ++ .../SotF/src/de/fhtrier/gdw2/sotf/Team.java | 17 +++++++ .../SotF/src/de/fhtrier/gdw2/sotf/World.java | 45 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Team.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/World.java diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/IWorld.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/IWorld.java index 251f1f0..9f1f512 100644 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/IWorld.java +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/IWorld.java @@ -12,10 +12,14 @@ public interface IWorld { /** * Deletes the given Entity from the World. + * @param + * Entity that will be removed */ public void delete(IEntity); /** + * @param + * Entity that will be added * @return * Adds the given Entity to the World-List * diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Team.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Team.java new file mode 100644 index 0000000..9099417 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Team.java @@ -0,0 +1,17 @@ +package de.fhtrier.gdw2.sotf; + +public class Team implements ITeam { + + @Override + public int getID() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean isTeamBuffActive() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/World.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/World.java new file mode 100644 index 0000000..98576ad --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/World.java @@ -0,0 +1,45 @@ +package de.fhtrier.gdw2.sotf; + +import java.util.List; + +import org.newdawn.slick.tiled.TiledMap; + +/** + * The World-Class + * @author Wendelin + * @param + * + */ +public class World implements IWorld { + + private TiledMap map; + List teams; + List entities; + + + World(String mapName) + { + map = new TiledMap("res/" + mapName); + //Enthaelt mapName die Datei-Endung? + //weitere Initialisierung im Constructor? + } + + + @Override + public List getEntities() { + return entities; + } + + @Override + public void delete(IEntity entity) { + entities.remove(entity); + } + + @Override + public void add(IEntity entity) { + entities.add(entity); + + } + + +} From 13cc28e4ac4c4cea0ce99d2a53be2d6737d33ef2 Mon Sep 17 00:00:00 2001 From: Tolamar Date: Tue, 24 Jul 2012 10:04:15 +0200 Subject: [PATCH 3/4] Test nach index --- .../gdw/sotf/states/GameplayState.java | 51 ++++++++++++++++ .../gdw/sotf/states/MainMenuState.java | 49 +++++++++++++++ .../gdw2/sotf/Interfaces/IEatable.java | 39 ++++++++++++ .../fhtrier/gdw2/sotf/Interfaces/IEntity.java | 39 ++++++++++++ .../fhtrier/gdw2/sotf/Interfaces/IPlayer.java | 60 +++++++++++++++++++ .../gdw2/sotf/Interfaces/IPowerups.java | 47 +++++++++++++++ .../gdw2/sotf/{ => Interfaces}/ITeam.java | 3 +- .../gdw2/sotf/Interfaces/IUseable.java | 30 ++++++++++ .../fhtrier/gdw2/sotf/Interfaces/IWorld.java | 26 ++++++++ .../src/de/fhtrier/gdw2/sotf/SlickTest.java | 45 -------------- .../fhtrier/gdw2/sotf/SlickTestGameState.java | 36 +++++++++++ .../src/de/fhtrier/gdw2/sotf/TestClass.java | 6 -- 12 files changed, 379 insertions(+), 52 deletions(-) create mode 100644 projects/SotF/src/de/fhtrier/gdw/sotf/states/GameplayState.java create mode 100644 projects/SotF/src/de/fhtrier/gdw/sotf/states/MainMenuState.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEatable.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEntity.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPlayer.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPowerups.java rename projects/SotF/src/de/fhtrier/gdw2/sotf/{ => Interfaces}/ITeam.java (87%) create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IUseable.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java delete mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTest.java create mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTestGameState.java delete mode 100644 projects/SotF/src/de/fhtrier/gdw2/sotf/TestClass.java diff --git a/projects/SotF/src/de/fhtrier/gdw/sotf/states/GameplayState.java b/projects/SotF/src/de/fhtrier/gdw/sotf/states/GameplayState.java new file mode 100644 index 0000000..8690e1a --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw/sotf/states/GameplayState.java @@ -0,0 +1,51 @@ +package de.fhtrier.gdw.sotf.states; + +import org.newdawn.slick.Color; +import org.newdawn.slick.GameContainer; +import org.newdawn.slick.Graphics; +import org.newdawn.slick.Input; +import org.newdawn.slick.SlickException; +import org.newdawn.slick.state.BasicGameState; +import org.newdawn.slick.state.StateBasedGame; + +public class GameplayState extends BasicGameState { + + int stateID = -1; + + public GameplayState(int stateID) { + this.stateID = stateID; + } + + @Override + public void init(GameContainer arg0, StateBasedGame arg1) + throws SlickException { + // TODO Auto-generated method stub + + } + + @Override + public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) + throws SlickException { + // TODO Auto-generated method stub + arg2.setBackground(Color.blue); + + } + + @Override + public void update(GameContainer arg0, StateBasedGame arg1, int arg2) + throws SlickException { + // TODO Auto-generated method stub + + if (arg0.getInput().isKeyDown(Input.KEY_2)) { + arg1.enterState(0); + } + + } + + @Override + public int getID() { + // TODO Auto-generated method stub + return stateID; + } + +} diff --git a/projects/SotF/src/de/fhtrier/gdw/sotf/states/MainMenuState.java b/projects/SotF/src/de/fhtrier/gdw/sotf/states/MainMenuState.java new file mode 100644 index 0000000..1bea002 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw/sotf/states/MainMenuState.java @@ -0,0 +1,49 @@ +package de.fhtrier.gdw.sotf.states; + +import org.newdawn.slick.Color; +import org.newdawn.slick.GameContainer; +import org.newdawn.slick.Graphics; +import org.newdawn.slick.Input; +import org.newdawn.slick.SlickException; +import org.newdawn.slick.state.BasicGameState; +import org.newdawn.slick.state.StateBasedGame; + +public class MainMenuState extends BasicGameState { + + int stateID = -1; + + public MainMenuState(int stateID) { + this.stateID = stateID; + } + + @Override + public void init(GameContainer arg0, StateBasedGame arg1) + throws SlickException { + // TODO Auto-generated method stub + + } + + @Override + public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) + throws SlickException { + // TODO Auto-generated method stub + arg2.setBackground(Color.green); + } + + @Override + public void update(GameContainer arg0, StateBasedGame arg1, int arg2) + throws SlickException { + // TODO Auto-generated method stub + + if (arg0.getInput().isKeyDown(Input.KEY_1)) { + arg1.enterState(1); + } + + } + + @Override + public int getID() { + // TODO Auto-generated method stub + return stateID; + } +} \ No newline at end of file diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEatable.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEatable.java new file mode 100644 index 0000000..07af5b6 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEatable.java @@ -0,0 +1,39 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +import java.util.List; + + +/** + * Interface zur Verwaltung eines Eatable. + * + * @author Kevin Korte + * @author Attila Djerdj + * @author Stefan Probst + */ +public interface IEatable { + + /** + * Liefert eine Liste vom Typ IPowerups + * mit den Powerups die auf den Spieler wirken, + * wenn er das Item isst. + * + * @return List + */ + public List getPowerups(); + + /** + * Liefert das Useable zurŸck falls + * das Eatable ein Useable enthŠlt. + * + * @return IUseable + */ + public IUseable getUseable(); + + /** + * Liefert zurŸck um wieviel der + * Spieler wŠchst. + * + * @return float + */ + public float getEnergy(); +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEntity.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEntity.java new file mode 100644 index 0000000..f02c426 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IEntity.java @@ -0,0 +1,39 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +import org.newdawn.slick.geom.Vector2f; +import java.awt.Graphics; +import org.newdawn.slick.*; + +public interface IEntity { + + + /** + * @return the current position of the player as Vector + */ + public abstract Vector2f getPosition(); + + + /** + * @param time ?????? + */ + public abstract void update(GameContainer gamecontainer, int deltaTime); + + + /** + * @return the current entity's radius + */ + public abstract float getRadius(); + + + /** + * @return the entity's ID + */ + public abstract int getID(); + + + /** + * @param g the graphics context the entity has to be drawn in + */ + public abstract void render(Graphics g); + +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPlayer.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPlayer.java new file mode 100644 index 0000000..d291a00 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPlayer.java @@ -0,0 +1,60 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +import org.newdawn.slick.geom.Vector2f; + + + +import java.util.List; + +public interface IPlayer extends IEntity { + + + /** + * @param velo the Vector that specifies the new velocity of the player + */ + public abstract void setVelocity(Vector2f velo); + + + /** + * @return the current velocity of the player + */ + public abstract Vector2f getVelocity(); + + + /** + * @param eat the Eatable item that affects the player + */ + public abstract void eat(IEatable eat); + + + /** + * @param number the number of the Usable in the player's Inventory + * @return the Usable item that is to be placed on the world + */ + public abstract IUseable use(int number); + + + /** + * @return the Inventory of the player as an array of Useables + */ + public abstract IUseable[] getInventory(); + + + /** + * @return list of Powerups that are currently active on the player + */ + public abstract List getPowerups(); + + + /** + * @return the team the player belongs to + */ + public abstract ITeam getTeam(); + + + /** + * @return whether the player is alive or dead + */ + public abstract boolean isDead(); + +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPowerups.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPowerups.java new file mode 100644 index 0000000..3f6a991 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IPowerups.java @@ -0,0 +1,47 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +/** + * Interface zur Verwaltung der Powerups. + * + * @author Kevin Korte + * @author Attila Djerdj + * @author Stefan Probst + */ +public interface IPowerups { + + enum PowerupType { + SPEED, + IMMORTAL, + SIGHT + } + + /** + * Liefert den Typ des Powerups. + * + * @return PowerupType + */ + public PowerupType getType(); + + /** + * Liefert einen Wert zurŸck um welchen + * Faktor das Powerup den akutellen Wert + * verŠndert. + * + * @return float + */ + public float getValue(); + + /** + * Liefert die Dauer des Powerups. + * + * @return int + */ + public int getDuration(); + + /** + * Legt die Dauer des Powerups fest. + * + * @param duration + */ + public void setDuration(int duration); +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/ITeam.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java similarity index 87% rename from projects/SotF/src/de/fhtrier/gdw2/sotf/ITeam.java rename to projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java index 73efccd..e2dc881 100644 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/ITeam.java +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java @@ -1,7 +1,8 @@ -package de.fhtrier.gdw2.sotf; +package de.fhtrier.gdw2.sotf.Interfaces; import java.util.List; + public interface ITeam { /** diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IUseable.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IUseable.java new file mode 100644 index 0000000..4c4f1d5 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IUseable.java @@ -0,0 +1,30 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +import java.util.List; + + +/** + * Interface fuer die benutzbaren Items im Inventar. + * + * @author Kevin Korte + * @author Attila Djerdj + * @author Stefan Probst + */ +public interface IUseable { + + /** + * Liefert eine Liste vom Typ IPowerups + * mit den Powerups die der Spieler wirken kann. + * + * @return List + */ + public List getPowerups(); + + /** + * Gibt an ob der Gegenstand vom + * Spieler fallen gelassen werden kann. + * + * @return boolean + */ + public boolean isDropable(); +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java new file mode 100644 index 0000000..60ce21f --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java @@ -0,0 +1,26 @@ +package de.fhtrier.gdw2.sotf.Interfaces; + +import java.util.List; + +public interface IWorld { +/** + * + * @return + * Returns a List of all Entities in the World. + */ + public List getEntities(); + + /** + * Deletes the given Entity from the World. + */ + public void delete(IEntity entity); + + /** + * @return + * Adds the given Entity to the World-List + * + */ + public void add(IEntity entity); + + +} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTest.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTest.java deleted file mode 100644 index 94ce092..0000000 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package de.fhtrier.gdw2.sotf; - -import org.newdawn.slick.AppGameContainer; -import org.newdawn.slick.BasicGame; -import org.newdawn.slick.Color; -import org.newdawn.slick.GameContainer; -import org.newdawn.slick.Graphics; -import org.newdawn.slick.SlickException; - -public class SlickTest extends BasicGame { - - public SlickTest() { - super("SlickTest"); - } - - @Override - public void render(GameContainer container, Graphics g) - throws SlickException { - g.setBackground(Color.green); - g.clear(); - } - - @Override - public void init(GameContainer container) throws SlickException { - // TODO Auto-generated method stub - - } - - @Override - public void update(GameContainer container, int delta) - throws SlickException { - // TODO Auto-generated method stub - - } - - public static void main(String[] args) { - try { - AppGameContainer app = new AppGameContainer(new SlickTest()); - app.start(); - } catch (SlickException e) { - e.printStackTrace(); - } - } - -} diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTestGameState.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTestGameState.java new file mode 100644 index 0000000..5babf80 --- /dev/null +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/SlickTestGameState.java @@ -0,0 +1,36 @@ + +package de.fhtrier.gdw2.sotf; + +import org.newdawn.slick.AppGameContainer; +import org.newdawn.slick.GameContainer; +import org.newdawn.slick.SlickException; +import org.newdawn.slick.state.StateBasedGame; + +import de.fhtrier.gdw.sotf.states.GameplayState; +import de.fhtrier.gdw.sotf.states.MainMenuState; + +public class SlickTestGameState extends StateBasedGame { + + public static final int MAINMENUSTATE = 0; + public static final int GAMEPLAYSTATE = 1; + + public SlickTestGameState() { + super("SlickTest"); + } + + public static void main(String[] args) { + try { + AppGameContainer app = new AppGameContainer(new SlickTestGameState()); + app.start(); + } catch (SlickException e) { + e.printStackTrace(); + } + } + + @Override + public void initStatesList(GameContainer arg0) throws SlickException { + this.addState(new MainMenuState(MAINMENUSTATE)); + this.addState(new GameplayState(GAMEPLAYSTATE)); + } + +} \ No newline at end of file diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/TestClass.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/TestClass.java deleted file mode 100644 index 690d8d1..0000000 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/TestClass.java +++ /dev/null @@ -1,6 +0,0 @@ -package de.fhtrier.gdw2.sotf; - -public class TestClass -{ - -} From 4aedba316f5fbc179460354d71f7e4c92d06de3b Mon Sep 17 00:00:00 2001 From: Tolamar Date: Tue, 24 Jul 2012 12:34:09 +0200 Subject: [PATCH 4/4] @Author ITeam + IWorld --- projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java | 4 +++- projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java index 09689d9..1d6e680 100644 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/ITeam.java @@ -1,5 +1,7 @@ package de.fhtrier.gdw2.sotf.Interfaces; - +/** + * @author Wendelin Lehr + */ import java.util.List; public interface ITeam diff --git a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java index dfdd4fe..4db0c93 100644 --- a/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java +++ b/projects/SotF/src/de/fhtrier/gdw2/sotf/Interfaces/IWorld.java @@ -1,5 +1,7 @@ package de.fhtrier.gdw2.sotf.Interfaces; - +/** + * @author Wendelin Lehr + */ import java.util.List; public interface IWorld