Compare commits
10 Commits
c97dcde07a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| df41cd63c3 | |||
| 18f6594ec7 | |||
| c52ba44c44 | |||
| 8a15fa5a51 | |||
| c0b6517f14 | |||
| 40d5295716 | |||
| 153f710a44 | |||
| d84b853b65 | |||
| bd0e81a2f7 | |||
| a36481e098 |
Binary file not shown.
@@ -26,7 +26,7 @@ public class EnemyProjectile extends Projectile
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//Check X-Value
|
//Check X-Value
|
||||||
if (getX() <= 0 || getX() >= getWorld().getHeight()-1){
|
if (getX() <= 0 || getX() >= getWorld().getWidth()-1){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Binary file not shown.
@@ -1,10 +1,11 @@
|
|||||||
#BlueJ class context
|
#BlueJ class context
|
||||||
comment0.target=GameOverWorld
|
comment0.target=GameOverWorld
|
||||||
comment0.text=\r\n\ Write\ a\ description\ of\ class\ GameOverWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
comment0.text=\r\n\ Write\ a\ description\ of\ class\ GameOverWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||||
comment1.params=
|
comment1.params=score
|
||||||
comment1.target=GameOverWorld()
|
comment1.target=GameOverWorld(int)
|
||||||
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ GameOverWorld.\r\n\ \r\n
|
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=void\ prepare()
|
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
|
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
|
comment3.params=
|
||||||
|
comment3.target=void\ showScore()
|
||||||
|
numComments=4
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ public class GameOverWorld extends World
|
|||||||
* Constructor for objects of class GameOverWorld.
|
* Constructor for objects of class GameOverWorld.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public GameOverWorld()
|
int score;
|
||||||
|
public GameOverWorld(int score)
|
||||||
{
|
{
|
||||||
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
||||||
super(400, 600, 1);
|
super(400, 600, 1);
|
||||||
|
this.score = score;
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +29,16 @@ public class GameOverWorld extends World
|
|||||||
private void prepare()
|
private void prepare()
|
||||||
{
|
{
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
addObject(button,200,320);
|
addObject(button,200,520);
|
||||||
button.setImage("Neustart.png");
|
button.setImage("Neustart.png");
|
||||||
|
showScore();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showScore(){
|
||||||
|
Color hintergrundFarbe = new Color(0,0,0,0);
|
||||||
|
GreenfootImage scoreBild = new GreenfootImage("" + score, 75, Color.WHITE, hintergrundFarbe);
|
||||||
|
Score score3 = new Score();
|
||||||
|
addObject(score3,200,72);
|
||||||
|
score3.setImage(scoreBild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -8,7 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
|||||||
*/
|
*/
|
||||||
public class Groundflower extends PowerUps
|
public class Groundflower extends PowerUps
|
||||||
{
|
{
|
||||||
int duration= 60*8; //15 Sekunden
|
int duration= 60*4; //15 Sekunden
|
||||||
/**
|
/**
|
||||||
* Act - do whatever the StarPowerUp wants to do. This method is called whenever
|
* Act - do whatever the StarPowerUp wants to do. This method is called whenever
|
||||||
* the 'Act' or 'Run' button gets pressed in the environment.
|
* the 'Act' or 'Run' button gets pressed in the environment.
|
||||||
|
|||||||
Binary file not shown.
+13
-12
@@ -35,12 +35,12 @@ public class MyWorld extends World
|
|||||||
{
|
{
|
||||||
Player player = new Player();
|
Player player = new Player();
|
||||||
addObject(player,302,320);
|
addObject(player,302,320);
|
||||||
Score score = new Score();
|
|
||||||
addObject(score, 200, 30);
|
|
||||||
score.setImage("Score1.png");
|
|
||||||
Score score1 = new Score();
|
Score score1 = new Score();
|
||||||
addObject(score1, 200, 60);
|
addObject(score1, 200, 30);
|
||||||
score1.setImage("Score2.png");
|
score1.setImage("Score1.png");
|
||||||
|
Score score2 = new Score();
|
||||||
|
addObject(score2, 200, 60);
|
||||||
|
score2.setImage("Score2.png");
|
||||||
Plattform plattform = new Plattform();
|
Plattform plattform = new Plattform();
|
||||||
addObject(plattform,285,577);
|
addObject(plattform,285,577);
|
||||||
plattform.setLocation(286,492);
|
plattform.setLocation(286,492);
|
||||||
@@ -65,7 +65,7 @@ public class MyWorld extends World
|
|||||||
Heart heart3 = new Heart();
|
Heart heart3 = new Heart();
|
||||||
addObject(heart3,314,27);
|
addObject(heart3,314,27);
|
||||||
|
|
||||||
addObject(new TemporaryGround(60*50), 200, 575);
|
addObject(new TemporaryGround(60*8), 200, 575);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void act()
|
public void act()
|
||||||
@@ -73,12 +73,12 @@ public class MyWorld extends World
|
|||||||
if (getObjects(Score.class).size() > 0){
|
if (getObjects(Score.class).size() > 0){
|
||||||
removeObjects(getObjects(Score.class));
|
removeObjects(getObjects(Score.class));
|
||||||
}
|
}
|
||||||
Score score = new Score();
|
|
||||||
addObject(score, 200, 30);
|
|
||||||
score.setImage("Score1.png");
|
|
||||||
Score score1 = new Score();
|
Score score1 = new Score();
|
||||||
addObject(score1, 200, 60);
|
addObject(score1, 200, 30);
|
||||||
score1.setImage("Score2.png");
|
score1.setImage("Score1.png");
|
||||||
|
Score score2 = new Score();
|
||||||
|
addObject(score2, 200, 60);
|
||||||
|
score2.setImage("Score2.png");
|
||||||
showScore();
|
showScore();
|
||||||
projectile();
|
projectile();
|
||||||
spawnEnemies();
|
spawnEnemies();
|
||||||
@@ -109,7 +109,7 @@ public class MyWorld extends World
|
|||||||
}
|
}
|
||||||
if(Greenfoot.getRandomNumber(100000)>=99750)
|
if(Greenfoot.getRandomNumber(100000)>=99750)
|
||||||
{
|
{
|
||||||
addObject(new SpikedPlattform(100), 1+Greenfoot.getRandomNumber(398), 6); //Nach Links bewegende Plattform
|
addObject(new SpikedPlattform(40), 1+Greenfoot.getRandomNumber(398), 6); //Nach Links bewegende Plattform
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,4 +185,5 @@ public class MyWorld extends World
|
|||||||
score = time/60;
|
score = time/60;
|
||||||
showText("" + score, 200, 60);
|
showText("" + score, 200, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -12,7 +12,7 @@ public class Player extends Actor
|
|||||||
int health = MAX_HEALTH;
|
int health = MAX_HEALTH;
|
||||||
|
|
||||||
int jumpBoostDuration = -1;
|
int jumpBoostDuration = -1;
|
||||||
int jumpBoostStrength = 5;
|
int jumpBoostStrength = 3;
|
||||||
|
|
||||||
boolean projectileReady = false;
|
boolean projectileReady = false;
|
||||||
int projectileTimer;
|
int projectileTimer;
|
||||||
@@ -38,7 +38,8 @@ public class Player extends Actor
|
|||||||
|
|
||||||
//Check ob der Spieler am unteren Fensterrand ist
|
//Check ob der Spieler am unteren Fensterrand ist
|
||||||
if (getY()+1 >= getWorld().getHeight()){
|
if (getY()+1 >= getWorld().getHeight()){
|
||||||
Greenfoot.setWorld(new GameOverWorld());
|
MyWorld world = (MyWorld) getWorld();
|
||||||
|
Greenfoot.setWorld(new GameOverWorld(world.score));
|
||||||
}
|
}
|
||||||
//Check ob der Spieler an der Seite vom Fenster ist
|
//Check ob der Spieler an der Seite vom Fenster ist
|
||||||
if (getX() <= 0){
|
if (getX() <= 0){
|
||||||
@@ -127,7 +128,8 @@ public class Player extends Actor
|
|||||||
|
|
||||||
public void checkHealth(){
|
public void checkHealth(){
|
||||||
if (health <= 0){
|
if (health <= 0){
|
||||||
Greenfoot.setWorld(new GameOverWorld());
|
MyWorld world = (MyWorld) getWorld();
|
||||||
|
Greenfoot.setWorld(new GameOverWorld(world.score));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -36,10 +36,6 @@ public class SpikedPlattform extends Plattform
|
|||||||
{
|
{
|
||||||
this.spikeTheSurface();
|
this.spikeTheSurface();
|
||||||
}
|
}
|
||||||
if(isSpiked && this.PlayerOnPlattform())
|
|
||||||
{
|
|
||||||
Greenfoot.setWorld(new GameOverWorld());
|
|
||||||
}
|
|
||||||
super.act();
|
super.act();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -26,7 +26,7 @@ public class StartWorld extends World
|
|||||||
private void prepare()
|
private void prepare()
|
||||||
{
|
{
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
addObject(button,200,320);
|
addObject(button,200,310);
|
||||||
button.setImage("Start.png");
|
button.setImage("Start.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -64,7 +64,7 @@ public class TemporaryGround extends Plattform
|
|||||||
Player player= this.getWorld().getObjects(Player.class).get(0);
|
Player player= this.getWorld().getObjects(Player.class).get(0);
|
||||||
if(this.intersects(player))
|
if(this.intersects(player))
|
||||||
{
|
{
|
||||||
player.setLocation(player.getX(), this.getY()-this.getImage().getHeight());
|
player.setLocation(player.getX(), this.getY()-this.getImage().getHeight()-5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 41 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
@@ -3,7 +3,7 @@ class.BreakingPlattform.image=Breaking1.png
|
|||||||
class.Button.image=button-red.png
|
class.Button.image=button-red.png
|
||||||
class.Enemy.image=Enemy.png
|
class.Enemy.image=Enemy.png
|
||||||
class.EnemyProjectile.image=EnemyProjectile.png
|
class.EnemyProjectile.image=EnemyProjectile.png
|
||||||
class.GameOverWorld.image=GameOverBackground.png
|
class.GameOverWorld.image=JUMP\ \u2018N\u2019\ RUNj.png
|
||||||
class.Ground.image=weave.jpg
|
class.Ground.image=weave.jpg
|
||||||
class.Groundflower.image=flower2.png
|
class.Groundflower.image=flower2.png
|
||||||
class.HealthItem.image=Health.png
|
class.HealthItem.image=Health.png
|
||||||
@@ -20,7 +20,7 @@ class.SpikedPlattform.image=Spikes2.png
|
|||||||
class.StartWorld.image=StartBackground.png
|
class.StartWorld.image=StartBackground.png
|
||||||
class.TargetingProjectile.image=TargetProjectile.png
|
class.TargetingProjectile.image=TargetProjectile.png
|
||||||
class.TemporaryGround.image=Ground.png
|
class.TemporaryGround.image=Ground.png
|
||||||
class.UnactiveSpike.image=inactiveSpike.png
|
class.UnactiveSpike.image=Spike_Copy.png
|
||||||
dependency1.from=PlayerTestWorld
|
dependency1.from=PlayerTestWorld
|
||||||
dependency1.to=Ground
|
dependency1.to=Ground
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
@@ -51,92 +51,92 @@ dependency17.type=UsesDependency
|
|||||||
dependency18.from=GameOverWorld
|
dependency18.from=GameOverWorld
|
||||||
dependency18.to=Button
|
dependency18.to=Button
|
||||||
dependency18.type=UsesDependency
|
dependency18.type=UsesDependency
|
||||||
dependency19.from=StartWorld
|
dependency19.from=GameOverWorld
|
||||||
dependency19.to=Button
|
dependency19.to=Score
|
||||||
dependency19.type=UsesDependency
|
dependency19.type=UsesDependency
|
||||||
dependency2.from=PlayerTestWorld
|
dependency2.from=PlayerTestWorld
|
||||||
dependency2.to=Player
|
dependency2.to=Player
|
||||||
dependency2.type=UsesDependency
|
dependency2.type=UsesDependency
|
||||||
dependency20.from=UnactiveSpike
|
dependency20.from=StartWorld
|
||||||
dependency20.to=SpikedPlattform
|
dependency20.to=Button
|
||||||
dependency20.type=UsesDependency
|
dependency20.type=UsesDependency
|
||||||
dependency21.from=UnactiveSpike
|
dependency21.from=UnactiveSpike
|
||||||
dependency21.to=MyWorld
|
dependency21.to=SpikedPlattform
|
||||||
dependency21.type=UsesDependency
|
dependency21.type=UsesDependency
|
||||||
dependency22.from=UnactiveSpike
|
dependency22.from=UnactiveSpike
|
||||||
dependency22.to=Spike
|
dependency22.to=MyWorld
|
||||||
dependency22.type=UsesDependency
|
dependency22.type=UsesDependency
|
||||||
dependency23.from=Button
|
dependency23.from=UnactiveSpike
|
||||||
dependency23.to=MyWorld
|
dependency23.to=Spike
|
||||||
dependency23.type=UsesDependency
|
dependency23.type=UsesDependency
|
||||||
dependency24.from=PowerUps
|
dependency24.from=Button
|
||||||
dependency24.to=Player
|
dependency24.to=MyWorld
|
||||||
dependency24.type=UsesDependency
|
dependency24.type=UsesDependency
|
||||||
dependency25.from=HealthItem
|
dependency25.from=PowerUps
|
||||||
dependency25.to=Player
|
dependency25.to=Player
|
||||||
dependency25.type=UsesDependency
|
dependency25.type=UsesDependency
|
||||||
dependency26.from=JumpBoostItem
|
dependency26.from=HealthItem
|
||||||
dependency26.to=Player
|
dependency26.to=Player
|
||||||
dependency26.type=UsesDependency
|
dependency26.type=UsesDependency
|
||||||
dependency27.from=Groundflower
|
dependency27.from=JumpBoostItem
|
||||||
dependency27.to=Player
|
dependency27.to=Player
|
||||||
dependency27.type=UsesDependency
|
dependency27.type=UsesDependency
|
||||||
dependency28.from=Enemy
|
dependency28.from=Groundflower
|
||||||
dependency28.to=Player
|
dependency28.to=Player
|
||||||
dependency28.type=UsesDependency
|
dependency28.type=UsesDependency
|
||||||
dependency29.from=Enemy
|
dependency29.from=Enemy
|
||||||
dependency29.to=EnemyProjectile
|
dependency29.to=Player
|
||||||
dependency29.type=UsesDependency
|
dependency29.type=UsesDependency
|
||||||
dependency3.from=PlayerTestWorld
|
dependency3.from=PlayerTestWorld
|
||||||
dependency3.to=JumpBoostItem
|
dependency3.to=JumpBoostItem
|
||||||
dependency3.type=UsesDependency
|
dependency3.type=UsesDependency
|
||||||
dependency30.from=Spike
|
dependency30.from=Enemy
|
||||||
dependency30.to=MyWorld
|
dependency30.to=EnemyProjectile
|
||||||
dependency30.type=UsesDependency
|
dependency30.type=UsesDependency
|
||||||
dependency31.from=Player
|
dependency31.from=Spike
|
||||||
dependency31.to=GameOverWorld
|
dependency31.to=MyWorld
|
||||||
dependency31.type=UsesDependency
|
dependency31.type=UsesDependency
|
||||||
dependency32.from=Player
|
dependency32.from=Player
|
||||||
dependency32.to=Plattform
|
dependency32.to=GameOverWorld
|
||||||
dependency32.type=UsesDependency
|
dependency32.type=UsesDependency
|
||||||
dependency33.from=Player
|
dependency33.from=Player
|
||||||
dependency33.to=PlayerProjectile
|
dependency33.to=Plattform
|
||||||
dependency33.type=UsesDependency
|
dependency33.type=UsesDependency
|
||||||
dependency34.from=Player
|
dependency34.from=Player
|
||||||
dependency34.to=TemporaryGround
|
dependency34.to=PlayerProjectile
|
||||||
dependency34.type=UsesDependency
|
dependency34.type=UsesDependency
|
||||||
dependency35.from=Player
|
dependency35.from=Player
|
||||||
dependency35.to=Projectile
|
dependency35.to=TemporaryGround
|
||||||
dependency35.type=UsesDependency
|
dependency35.type=UsesDependency
|
||||||
dependency36.from=Player
|
dependency36.from=Player
|
||||||
dependency36.to=Enemy
|
dependency36.to=Projectile
|
||||||
dependency36.type=UsesDependency
|
dependency36.type=UsesDependency
|
||||||
dependency37.from=Player
|
dependency37.from=Player
|
||||||
dependency37.to=Spike
|
dependency37.to=Enemy
|
||||||
dependency37.type=UsesDependency
|
dependency37.type=UsesDependency
|
||||||
dependency38.from=Plattform
|
dependency38.from=Player
|
||||||
dependency38.to=MyWorld
|
dependency38.to=Spike
|
||||||
dependency38.type=UsesDependency
|
dependency38.type=UsesDependency
|
||||||
dependency39.from=Plattform
|
dependency39.from=Plattform
|
||||||
dependency39.to=Player
|
dependency39.to=MyWorld
|
||||||
dependency39.type=UsesDependency
|
dependency39.type=UsesDependency
|
||||||
dependency4.from=MyWorld
|
dependency4.from=MyWorld
|
||||||
dependency4.to=Player
|
dependency4.to=Player
|
||||||
dependency4.type=UsesDependency
|
dependency4.type=UsesDependency
|
||||||
dependency40.from=MovingPlattform
|
dependency40.from=Plattform
|
||||||
dependency40.to=MyWorld
|
dependency40.to=Player
|
||||||
dependency40.type=UsesDependency
|
dependency40.type=UsesDependency
|
||||||
dependency41.from=MovingPlattform
|
dependency41.from=MovingPlattform
|
||||||
dependency41.to=Player
|
dependency41.to=MyWorld
|
||||||
dependency41.type=UsesDependency
|
dependency41.type=UsesDependency
|
||||||
dependency42.from=TemporaryGround
|
dependency42.from=MovingPlattform
|
||||||
dependency42.to=Player
|
dependency42.to=Player
|
||||||
dependency42.type=UsesDependency
|
dependency42.type=UsesDependency
|
||||||
dependency43.from=SpikedPlattform
|
dependency43.from=TemporaryGround
|
||||||
dependency43.to=Spike
|
dependency43.to=Player
|
||||||
dependency43.type=UsesDependency
|
dependency43.type=UsesDependency
|
||||||
dependency44.from=SpikedPlattform
|
dependency44.from=SpikedPlattform
|
||||||
dependency44.to=GameOverWorld
|
dependency44.to=Spike
|
||||||
dependency44.type=UsesDependency
|
dependency44.type=UsesDependency
|
||||||
dependency45.from=SpikedPlattform
|
dependency45.from=SpikedPlattform
|
||||||
dependency45.to=MyWorld
|
dependency45.to=MyWorld
|
||||||
@@ -169,7 +169,7 @@ editor.fx.0.height=607
|
|||||||
editor.fx.0.width=1092
|
editor.fx.0.width=1092
|
||||||
editor.fx.0.x=223
|
editor.fx.0.x=223
|
||||||
editor.fx.0.y=111
|
editor.fx.0.y=111
|
||||||
height=830
|
height=814
|
||||||
package.numDependencies=48
|
package.numDependencies=48
|
||||||
package.numTargets=25
|
package.numTargets=25
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
@@ -362,7 +362,7 @@ target9.width=120
|
|||||||
target9.x=0
|
target9.x=0
|
||||||
target9.y=0
|
target9.y=0
|
||||||
version=3.1.0
|
version=3.1.0
|
||||||
width=1550
|
width=1534
|
||||||
world.lastInstantiated=StartWorld
|
world.lastInstantiated=StartWorld
|
||||||
xPosition=0
|
xPosition=0
|
||||||
yPosition=0
|
yPosition=117
|
||||||
|
|||||||
Reference in New Issue
Block a user