Merge remote-tracking branch 'origin/main'

# Conflicts:
#	SMIMS-Game/MyWorld.class
This commit is contained in:
2026-09-15 20:06:40 +02:00
7 changed files with 43 additions and 1 deletions
Binary file not shown.
+2
View File
@@ -31,6 +31,8 @@ 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, 50);
} }
public void act() public void act()
Binary file not shown.
+1 -1
View File
@@ -64,7 +64,7 @@ public class Player extends Actor
setLocation(getX(), newY); setLocation(getX(), newY);
Actor ground = getOneIntersectingObject(Ground.class); Actor ground = getOneIntersectingObject(Plattform.class);
if (ground != null && verticalSpeed >= 0) if (ground != null && verticalSpeed >= 0)
{ {
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
#BlueJ class context
comment0.target=Score
comment0.text=\r\n\ Write\ a\ description\ of\ class\ UI\ 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\ UI\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
comment2.params=
comment2.target=void\ draw_score()
comment3.params=
comment3.target=int\ calculate_score()
numComments=4
+29
View File
@@ -0,0 +1,29 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class UI here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Score extends Actor
{
int timer;
/**
* Act - do whatever the UI wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
timer++;
draw_score();
}
public void draw_score(){
setImage(new GreenfootImage("Score:" + calculate_score(), 24, Color.WHITE, Color.BLACK));
}
public int calculate_score(){
return timer/60;
}
}