Score und neue Platforms sowie Player Figur

This commit is contained in:
2026-09-16 16:22:07 +02:00
parent da0a97adfe
commit b095aeb05f
16 changed files with 191 additions and 38 deletions
+24 -5
View File
@@ -9,9 +9,11 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class MyWorld extends World
{
int PlattformCountdown;
int timer = 200; //Zeit, bevor das erste Projektil auftaucht
int timer = 300; //Zeit, bevor das erste Projektil auftaucht
//kann später noch beliebig angepasst werden
int targetTimer = 100;
int targetTimer = 1000;
int time = 0;
int score = 0;
/**
* Constructor for objects of class MyWorld.
*
@@ -32,7 +34,11 @@ public class MyWorld extends World
Player player = new Player();
addObject(player,302,320);
Score score = new Score();
addObject(score, 200, 50);
addObject(score, 200, 30);
score.setImage("Score1.png");
Score score1 = new Score();
addObject(score1, 200, 60);
score1.setImage("Score2.png");
Plattform plattform = new Plattform();
addObject(plattform,285,577);
plattform.setLocation(286,492);
@@ -54,6 +60,13 @@ public class MyWorld extends World
public void act()
{
Score score = new Score();
addObject(score, 200, 30);
score.setImage("Score1.png");
Score score1 = new Score();
addObject(score1, 200, 60);
score1.setImage("Score2.png");
showScore();
projectile();
targetingProjectile();
if(PlattformCountdown==0) //Damit in regelmäßigen Abständen auf jeden Fall eine Plattform auftaucht
@@ -89,7 +102,7 @@ public class MyWorld extends World
if(timer == 0){
Projectile projectile = new Projectile();
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
timer = 200; //zeitlicher Abstand
timer = 300; //zeitlicher Abstand
}
else{
timer = timer - 1;
@@ -100,10 +113,16 @@ public class MyWorld extends World
if(targetTimer == 0){
TargetingProjectile targetingProjectile = new TargetingProjectile();
addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
targetTimer = 100;
targetTimer = 1000;
}
else{
targetTimer = targetTimer - 1;
}
}
public void showScore(){
time++;
score = time/60;
showText("" + score, 200, 60);
}
}