Compare commits
2 Commits
e0d532b848
...
ec0e80fe97
| Author | SHA1 | Date | |
|---|---|---|---|
| ec0e80fe97 | |||
| 13edb7d2b6 |
Generated
+10
@@ -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
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/SMIMS-Game.iml" filepath="$PROJECT_DIR$/SMIMS-Game.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
@@ -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
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -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
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/SMIMS-Game" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user