diff --git a/SMIMS-Game/.idea/.gitignore b/SMIMS-Game/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/SMIMS-Game/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/SMIMS-Game/.idea/misc.xml b/SMIMS-Game/.idea/misc.xml new file mode 100644 index 0000000..6f29fee --- /dev/null +++ b/SMIMS-Game/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SMIMS-Game/.idea/modules.xml b/SMIMS-Game/.idea/modules.xml new file mode 100644 index 0000000..d9df081 --- /dev/null +++ b/SMIMS-Game/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/SMIMS-Game/.idea/vcs.xml b/SMIMS-Game/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/SMIMS-Game/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SMIMS-Game/Ground.class b/SMIMS-Game/Ground.class new file mode 100644 index 0000000..220e061 Binary files /dev/null and b/SMIMS-Game/Ground.class differ diff --git a/SMIMS-Game/Ground.ctxt b/SMIMS-Game/Ground.ctxt new file mode 100644 index 0000000..274ad51 --- /dev/null +++ b/SMIMS-Game/Ground.ctxt @@ -0,0 +1,7 @@ +#BlueJ class context +comment0.target=Ground +comment0.text=\r\n\ Write\ a\ description\ of\ class\ Ground\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params= +comment1.target=void\ act() +comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ Ground\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n +numComments=2 diff --git a/SMIMS-Game/Ground.java b/SMIMS-Game/Ground.java new file mode 100644 index 0000000..985c4c8 --- /dev/null +++ b/SMIMS-Game/Ground.java @@ -0,0 +1,19 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Ground here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Ground extends Actor +{ + /** + * Act - do whatever the Ground wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + // Add your action code here. + } +} diff --git a/SMIMS-Game/MyWorld.class b/SMIMS-Game/MyWorld.class new file mode 100644 index 0000000..c9c4726 Binary files /dev/null and b/SMIMS-Game/MyWorld.class differ diff --git a/SMIMS-Game/MyWorld.ctxt b/SMIMS-Game/MyWorld.ctxt new file mode 100644 index 0000000..25b6c20 --- /dev/null +++ b/SMIMS-Game/MyWorld.ctxt @@ -0,0 +1,10 @@ +#BlueJ class context +comment0.target=MyWorld +comment0.text=\r\n\ Write\ a\ description\ of\ class\ MyWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params= +comment1.target=MyWorld() +comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ MyWorld.\r\n\ \r\n +comment2.params= +comment2.target=void\ prepare() +comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\ That\ is\:\ create\ the\ initial\ objects\ and\ add\ them\ to\ the\ world.\r\n +numComments=3 diff --git a/SMIMS-Game/MyWorld.java b/SMIMS-Game/MyWorld.java new file mode 100644 index 0000000..b18d2c8 --- /dev/null +++ b/SMIMS-Game/MyWorld.java @@ -0,0 +1,31 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class MyWorld here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class MyWorld extends World +{ + + /** + * Constructor for objects of class MyWorld. + * + */ + public MyWorld() + { + // Create a new world with 600x400 cells with a cell size of 1x1 pixels. + super(400, 600, 1); + prepare(); + } + /** + * Prepare the world for the start of the program. + * That is: create the initial objects and add them to the world. + */ + private void prepare() + { + Player player = new Player(); + addObject(player,302,320); + } +} diff --git a/SMIMS-Game/Player.class b/SMIMS-Game/Player.class new file mode 100644 index 0000000..53822cc Binary files /dev/null and b/SMIMS-Game/Player.class differ diff --git a/SMIMS-Game/Player.ctxt b/SMIMS-Game/Player.ctxt new file mode 100644 index 0000000..c19adf5 --- /dev/null +++ b/SMIMS-Game/Player.ctxt @@ -0,0 +1,10 @@ +#BlueJ class context +comment0.target=Player +comment0.text=\r\n\ Write\ a\ description\ of\ class\ Player\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params= +comment1.target=void\ act() +comment2.params= +comment2.target=void\ player_movement() +comment3.params= +comment3.target=boolean\ onGround() +numComments=4 diff --git a/SMIMS-Game/Player.java b/SMIMS-Game/Player.java new file mode 100644 index 0000000..f3a9eaf --- /dev/null +++ b/SMIMS-Game/Player.java @@ -0,0 +1,38 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Player here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Player extends Actor +{ + int velocityY = 0; + int speed = 5; + public void act() + { + player_movement(); + } + + public void player_movement(){ + if (Greenfoot.isKeyDown("D")){ + setLocation(getX()+speed, getY()); + } + if (Greenfoot.isKeyDown("A")){ + setLocation(getX()-speed, getY()); + } + } + + public boolean onGround(){ + int height = getImage().getHeight(); + + Actor floor = getOneObjectAtOffset( + 0, + height / 2 + 1, + Ground.class + ); + + return floor != null; + } +} diff --git a/SMIMS-Game/README.TXT b/SMIMS-Game/README.TXT new file mode 100644 index 0000000..7342ea5 --- /dev/null +++ b/SMIMS-Game/README.TXT @@ -0,0 +1,12 @@ +------------------------------------------------------------------------ +This is the project README file. Here, you should describe your project. +Tell the reader (someone who does not know anything about this project) +all they need to know. The comments should usually include at least: +------------------------------------------------------------------------ + +PROJECT TITLE: +PURPOSE OF PROJECT: +VERSION or DATE: +HOW TO START THIS PROJECT: +AUTHORS: +USER INSTRUCTIONS: diff --git a/SMIMS-Game/SMIMS-Game.iml b/SMIMS-Game/SMIMS-Game.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/SMIMS-Game/SMIMS-Game.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/SMIMS-Game/images/ppl2.png b/SMIMS-Game/images/ppl2.png new file mode 100644 index 0000000..14f2b01 Binary files /dev/null and b/SMIMS-Game/images/ppl2.png differ diff --git a/SMIMS-Game/images/weave.jpg b/SMIMS-Game/images/weave.jpg new file mode 100644 index 0000000..4d26e04 Binary files /dev/null and b/SMIMS-Game/images/weave.jpg differ diff --git a/SMIMS-Game/project.greenfoot b/SMIMS-Game/project.greenfoot new file mode 100644 index 0000000..73e93c0 --- /dev/null +++ b/SMIMS-Game/project.greenfoot @@ -0,0 +1,56 @@ +#Greenfoot project file +class.Ground.image=weave.jpg +class.Player.image=ppl2.png +dependency1.from=MyWorld +dependency1.to=Player +dependency1.type=UsesDependency +dependency2.from=Player +dependency2.to=Ground +dependency2.type=UsesDependency +editor.fx.0.height=0 +editor.fx.0.width=0 +editor.fx.0.x=0 +editor.fx.0.y=0 +height=736 +package.numDependencies=2 +package.numTargets=3 +project.charset=UTF-8 +publish.hasSource=false +publish.locked=true +publish.longDesc= +publish.shortDesc= +publish.tags= +publish.title= +publish.url= +readme.height=60 +readme.name=@README +readme.width=49 +readme.x=10 +readme.y=10 +simulation.speed=50 +target1.height=70 +target1.name=Player +target1.showInterface=false +target1.type=ClassTarget +target1.width=120 +target1.x=0 +target1.y=0 +target2.height=70 +target2.name=Ground +target2.showInterface=false +target2.type=ClassTarget +target2.width=120 +target2.x=0 +target2.y=0 +target3.height=70 +target3.name=MyWorld +target3.showInterface=false +target3.type=ClassTarget +target3.width=120 +target3.x=0 +target3.y=0 +version=3.1.0 +width=856 +world.lastInstantiated=MyWorld +xPosition=652 +yPosition=76