Items werden automatisch erzeugt
This commit is contained in:
Binary file not shown.
@@ -8,7 +8,6 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class HealthItem extends PowerUps
|
||||
{
|
||||
int duration = 60*60;
|
||||
public void act()
|
||||
{
|
||||
moveDown();
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class JumpBoostItem extends PowerUps
|
||||
{
|
||||
int duration = 60*60;
|
||||
int duration = 60*5;
|
||||
public void act()
|
||||
{
|
||||
moveDown();
|
||||
|
||||
Binary file not shown.
@@ -10,11 +10,13 @@ comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\
|
||||
comment3.params=
|
||||
comment3.target=void\ act()
|
||||
comment4.params=
|
||||
comment4.target=void\ spawnEnemies()
|
||||
comment4.target=void\ spawnItems()
|
||||
comment5.params=
|
||||
comment5.target=void\ projectile()
|
||||
comment5.target=void\ spawnEnemies()
|
||||
comment6.params=
|
||||
comment6.target=void\ targetingProjectile()
|
||||
comment6.target=void\ projectile()
|
||||
comment7.params=
|
||||
comment7.target=void\ showScore()
|
||||
numComments=8
|
||||
comment7.target=void\ targetingProjectile()
|
||||
comment8.params=
|
||||
comment8.target=void\ showScore()
|
||||
numComments=9
|
||||
|
||||
+24
-7
@@ -14,6 +14,7 @@ public class MyWorld extends World
|
||||
int targetTimer = 1000;
|
||||
int time = 0;
|
||||
int enemyTimer;
|
||||
int itemTimer;
|
||||
int score = 0;
|
||||
/**
|
||||
* Constructor for objects of class MyWorld.
|
||||
@@ -84,6 +85,7 @@ public class MyWorld extends World
|
||||
projectile();
|
||||
spawnEnemies();
|
||||
targetingProjectile();
|
||||
spawnItems();
|
||||
if(PlattformCountdown==0) //Damit in regelmäßigen Abständen auf jeden Fall eine Plattform auftaucht
|
||||
{
|
||||
addObject(new Plattform(), Greenfoot.getRandomNumber(400), 5);
|
||||
@@ -110,19 +112,34 @@ public class MyWorld extends World
|
||||
{
|
||||
addObject(new SpikedPlattform(100), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||
}
|
||||
}
|
||||
|
||||
if(Greenfoot.getRandomNumber(100000)>=99750)
|
||||
{
|
||||
addObject(new Groundflower(), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||
public void spawnItems(){
|
||||
itemTimer++;
|
||||
if (itemTimer >= 575){
|
||||
itemTimer = 0;
|
||||
switch (Greenfoot.getRandomNumber(3)){
|
||||
case 0:
|
||||
Groundflower groundF = new Groundflower();
|
||||
addObject(groundF, Greenfoot.getRandomNumber(getWidth()-100)+50,0);
|
||||
break;
|
||||
case 1:
|
||||
HealthItem healthItem = new HealthItem();
|
||||
addObject(healthItem, Greenfoot.getRandomNumber(getWidth()-100)+50,0);
|
||||
break;
|
||||
case 2:
|
||||
JumpBoostItem jumpBoostItem = new JumpBoostItem();
|
||||
addObject(jumpBoostItem, Greenfoot.getRandomNumber(getWidth()-100)+50,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void spawnEnemies(){
|
||||
enemyTimer++;
|
||||
if (enemyTimer == 420){
|
||||
Enemy enemy = new Enemy(Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight()/2));
|
||||
addObject(enemy, Greenfoot.getRandomNumber(300)+50,0);
|
||||
if (enemyTimer >= 420){
|
||||
Enemy enemy = new Enemy(Greenfoot.getRandomNumber(getWidth() - 50) + 25, Greenfoot.getRandomNumber(getHeight()/2) + 15);
|
||||
addObject(enemy, Greenfoot.getRandomNumber(getWidth()-100)+50,0);
|
||||
enemyTimer = 0;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -81,7 +81,7 @@ public class Player extends Actor
|
||||
java.util.List<Plattform> platforms = getIntersectingObjects(Plattform.class);
|
||||
boolean landed = false;
|
||||
for (Plattform platform : platforms) {
|
||||
int groundTop = platform.getY()+5 - platform.getImage().getHeight() / 2;
|
||||
int groundTop = platform.getY() - platform.getImage().getHeight() / 2;
|
||||
int characterBottom = getY() + getImage().getHeight() / 2;
|
||||
int oldCharacterBottom = oldY + getImage().getHeight() / 2;
|
||||
// Prüfen, ob der Spieler von oben auf diese Plattform fällt
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
class.BreakingPlattform.image=Breaking1.png
|
||||
class.Button.image=button-red.png
|
||||
class.Enemy.image=bee.png
|
||||
class.EnemyProjectile.image=yellow-draught.png
|
||||
class.GameOverWorld.image=GameOverBackground.png
|
||||
class.Ground.image=weave.jpg
|
||||
class.Groundflower.image=flower2.png
|
||||
@@ -18,6 +19,7 @@ class.Spike.image=singleSpike.png
|
||||
class.SpikedPlattform.image=Spikes2.png
|
||||
class.StartWorld.image=StartBackground.png
|
||||
class.TargetingProjectile.image=blue-draught.png
|
||||
class.TemporaryGround.image=TemporaryGround.png
|
||||
class.UnactiveSpike.image=inactiveSpike.png
|
||||
dependency1.from=PlayerTestWorld
|
||||
dependency1.to=Ground
|
||||
@@ -32,125 +34,131 @@ dependency12.from=MyWorld
|
||||
dependency12.to=Groundflower
|
||||
dependency12.type=UsesDependency
|
||||
dependency13.from=MyWorld
|
||||
dependency13.to=Enemy
|
||||
dependency13.to=HealthItem
|
||||
dependency13.type=UsesDependency
|
||||
dependency14.from=MyWorld
|
||||
dependency14.to=Projectile
|
||||
dependency14.to=JumpBoostItem
|
||||
dependency14.type=UsesDependency
|
||||
dependency15.from=MyWorld
|
||||
dependency15.to=TargetingProjectile
|
||||
dependency15.to=Enemy
|
||||
dependency15.type=UsesDependency
|
||||
dependency16.from=GameOverWorld
|
||||
dependency16.to=Button
|
||||
dependency16.from=MyWorld
|
||||
dependency16.to=Projectile
|
||||
dependency16.type=UsesDependency
|
||||
dependency17.from=StartWorld
|
||||
dependency17.to=Button
|
||||
dependency17.from=MyWorld
|
||||
dependency17.to=TargetingProjectile
|
||||
dependency17.type=UsesDependency
|
||||
dependency18.from=UnactiveSpike
|
||||
dependency18.to=SpikedPlattform
|
||||
dependency18.from=GameOverWorld
|
||||
dependency18.to=Button
|
||||
dependency18.type=UsesDependency
|
||||
dependency19.from=UnactiveSpike
|
||||
dependency19.to=MyWorld
|
||||
dependency19.from=StartWorld
|
||||
dependency19.to=Button
|
||||
dependency19.type=UsesDependency
|
||||
dependency2.from=PlayerTestWorld
|
||||
dependency2.to=Player
|
||||
dependency2.type=UsesDependency
|
||||
dependency20.from=UnactiveSpike
|
||||
dependency20.to=Spike
|
||||
dependency20.to=SpikedPlattform
|
||||
dependency20.type=UsesDependency
|
||||
dependency21.from=Button
|
||||
dependency21.from=UnactiveSpike
|
||||
dependency21.to=MyWorld
|
||||
dependency21.type=UsesDependency
|
||||
dependency22.from=PowerUps
|
||||
dependency22.to=Player
|
||||
dependency22.from=UnactiveSpike
|
||||
dependency22.to=Spike
|
||||
dependency22.type=UsesDependency
|
||||
dependency23.from=HealthItem
|
||||
dependency23.to=Player
|
||||
dependency23.from=Button
|
||||
dependency23.to=MyWorld
|
||||
dependency23.type=UsesDependency
|
||||
dependency24.from=JumpBoostItem
|
||||
dependency24.from=PowerUps
|
||||
dependency24.to=Player
|
||||
dependency24.type=UsesDependency
|
||||
dependency25.from=Groundflower
|
||||
dependency25.from=HealthItem
|
||||
dependency25.to=Player
|
||||
dependency25.type=UsesDependency
|
||||
dependency26.from=Enemy
|
||||
dependency26.from=JumpBoostItem
|
||||
dependency26.to=Player
|
||||
dependency26.type=UsesDependency
|
||||
dependency27.from=Enemy
|
||||
dependency27.to=EnemyProjectile
|
||||
dependency27.from=Groundflower
|
||||
dependency27.to=Player
|
||||
dependency27.type=UsesDependency
|
||||
dependency28.from=Spike
|
||||
dependency28.to=MyWorld
|
||||
dependency28.from=Enemy
|
||||
dependency28.to=Player
|
||||
dependency28.type=UsesDependency
|
||||
dependency29.from=Player
|
||||
dependency29.to=GameOverWorld
|
||||
dependency29.from=Enemy
|
||||
dependency29.to=EnemyProjectile
|
||||
dependency29.type=UsesDependency
|
||||
dependency3.from=PlayerTestWorld
|
||||
dependency3.to=JumpBoostItem
|
||||
dependency3.type=UsesDependency
|
||||
dependency30.from=Player
|
||||
dependency30.to=Plattform
|
||||
dependency30.from=Spike
|
||||
dependency30.to=MyWorld
|
||||
dependency30.type=UsesDependency
|
||||
dependency31.from=Player
|
||||
dependency31.to=PlayerProjectile
|
||||
dependency31.to=GameOverWorld
|
||||
dependency31.type=UsesDependency
|
||||
dependency32.from=Player
|
||||
dependency32.to=TemporaryGround
|
||||
dependency32.to=Plattform
|
||||
dependency32.type=UsesDependency
|
||||
dependency33.from=Player
|
||||
dependency33.to=Projectile
|
||||
dependency33.to=PlayerProjectile
|
||||
dependency33.type=UsesDependency
|
||||
dependency34.from=Player
|
||||
dependency34.to=Enemy
|
||||
dependency34.to=TemporaryGround
|
||||
dependency34.type=UsesDependency
|
||||
dependency35.from=Player
|
||||
dependency35.to=Spike
|
||||
dependency35.to=Projectile
|
||||
dependency35.type=UsesDependency
|
||||
dependency36.from=Player
|
||||
dependency36.to=Heart
|
||||
dependency36.to=Enemy
|
||||
dependency36.type=UsesDependency
|
||||
dependency37.from=Healthbar
|
||||
dependency37.to=Player
|
||||
dependency37.from=Player
|
||||
dependency37.to=Spike
|
||||
dependency37.type=UsesDependency
|
||||
dependency38.from=Plattform
|
||||
dependency38.to=MyWorld
|
||||
dependency38.from=Player
|
||||
dependency38.to=Heart
|
||||
dependency38.type=UsesDependency
|
||||
dependency39.from=Plattform
|
||||
dependency39.from=Healthbar
|
||||
dependency39.to=Player
|
||||
dependency39.type=UsesDependency
|
||||
dependency4.from=MyWorld
|
||||
dependency4.to=Player
|
||||
dependency4.type=UsesDependency
|
||||
dependency40.from=MovingPlattform
|
||||
dependency40.from=Plattform
|
||||
dependency40.to=MyWorld
|
||||
dependency40.type=UsesDependency
|
||||
dependency41.from=MovingPlattform
|
||||
dependency41.from=Plattform
|
||||
dependency41.to=Player
|
||||
dependency41.type=UsesDependency
|
||||
dependency42.from=TemporaryGround
|
||||
dependency42.to=Player
|
||||
dependency42.from=MovingPlattform
|
||||
dependency42.to=MyWorld
|
||||
dependency42.type=UsesDependency
|
||||
dependency43.from=SpikedPlattform
|
||||
dependency43.to=Spike
|
||||
dependency43.from=MovingPlattform
|
||||
dependency43.to=Player
|
||||
dependency43.type=UsesDependency
|
||||
dependency44.from=SpikedPlattform
|
||||
dependency44.to=GameOverWorld
|
||||
dependency44.from=TemporaryGround
|
||||
dependency44.to=Player
|
||||
dependency44.type=UsesDependency
|
||||
dependency45.from=SpikedPlattform
|
||||
dependency45.to=MyWorld
|
||||
dependency45.to=Spike
|
||||
dependency45.type=UsesDependency
|
||||
dependency46.from=SpikedPlattform
|
||||
dependency46.to=UnactiveSpike
|
||||
dependency46.to=GameOverWorld
|
||||
dependency46.type=UsesDependency
|
||||
dependency47.from=TargetingProjectile
|
||||
dependency47.to=Player
|
||||
dependency47.from=SpikedPlattform
|
||||
dependency47.to=MyWorld
|
||||
dependency47.type=UsesDependency
|
||||
dependency48.from=PlayerProjectile
|
||||
dependency48.to=Enemy
|
||||
dependency48.from=SpikedPlattform
|
||||
dependency48.to=UnactiveSpike
|
||||
dependency48.type=UsesDependency
|
||||
dependency49.from=TargetingProjectile
|
||||
dependency49.to=Player
|
||||
dependency49.type=UsesDependency
|
||||
dependency5.from=MyWorld
|
||||
dependency5.to=Score
|
||||
dependency5.type=UsesDependency
|
||||
dependency50.from=PlayerProjectile
|
||||
dependency50.to=Enemy
|
||||
dependency50.type=UsesDependency
|
||||
dependency6.from=MyWorld
|
||||
dependency6.to=Plattform
|
||||
dependency6.type=UsesDependency
|
||||
@@ -165,10 +173,10 @@ dependency9.to=MovingPlattform
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=814
|
||||
editor.fx.0.x=386
|
||||
editor.fx.0.y=48
|
||||
editor.fx.0.x=668
|
||||
editor.fx.0.y=120
|
||||
height=830
|
||||
package.numDependencies=48
|
||||
package.numDependencies=50
|
||||
package.numTargets=26
|
||||
project.charset=UTF-8
|
||||
publish.hasSource=false
|
||||
|
||||
Reference in New Issue
Block a user