-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscore.java
More file actions
29 lines (27 loc) · 793 Bytes
/
score.java
File metadata and controls
29 lines (27 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class score here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class score extends Actor
{
/**
* Act - do whatever the score wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public static int score;//membuat variabel score
public score(){
score = 0;//pemberian nilai asal
}
public void act()
{
World myWorld = getWorld();
myWorld.showText(String.valueOf(score), 300, 100);//penempatan score
}
//skor akan bertambah sesuai dengan pipa yang dilewati
public static void add(int num){
score += num;
}
}