Skip to content

Commit 124d96d

Browse files
author
github-actions
committed
Google Java Format
1 parent 9a622d6 commit 124d96d

File tree

178 files changed

+8313
-8265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+8313
-8265
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import org.openpatch.scratch.*;
22

33
public class GhostSprite extends AnimatedSprite {
4-
5-
private int speed = 8;
6-
7-
public GhostSprite() {
8-
this.addAnimation("idle", "sprites/ghost/ghost_%02d.png", 10);
9-
this.addSound("laugh", "sounds/ghost.wav");
10-
this.setSize(70);
4+
5+
private int speed = 8;
6+
7+
public GhostSprite() {
8+
this.addAnimation("idle", "sprites/ghost/ghost_%02d.png", 10);
9+
this.addSound("laugh", "sounds/ghost.wav");
10+
this.setSize(70);
11+
}
12+
13+
public void run() {
14+
if (isKeyPressed(37)) {
15+
this.changeX(-speed);
16+
} else if (isKeyPressed(39)) {
17+
this.changeX(speed);
18+
}
19+
if (isKeyPressed(38)) {
20+
this.changeY(-speed);
21+
} else if (isKeyPressed(40)) {
22+
this.changeY(speed);
1123
}
12-
13-
public void run() {
14-
if(isKeyPressed(37)) {
15-
this.changeX(-speed);
16-
} else if (isKeyPressed(39)) {
17-
this.changeX(speed);
18-
}
19-
if(isKeyPressed(38)) {
20-
this.changeY(-speed);
21-
} else if(isKeyPressed(40)) {
22-
this.changeY(speed);
23-
}
24-
if(isTouchingMousePointer()) {
25-
this.playSound("laugh");
26-
}
27-
this.playAnimation("idle");
24+
if (isTouchingMousePointer()) {
25+
this.playSound("laugh");
2826
}
29-
}
27+
this.playAnimation("idle");
28+
}
29+
}
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
import org.openpatch.scratch.*;
22

3-
public class HalloweenStage extends Stage
4-
{
5-
int numberPumpkins = 10;
6-
HouseSprite house;
7-
GhostSprite ghost;
8-
9-
public HalloweenStage() {
10-
super(400, 400);
11-
this.addBackdrop("bg", "sprites/background.jpg");
12-
this.addSound("bg", "sounds/background.wav");
13-
14-
house = new HouseSprite();
15-
this.add(house);
16-
17-
for (int i = 0; i < numberPumpkins; i++) {
18-
PumpkinSprite p = new PumpkinSprite();
19-
this.add(p);
20-
}
21-
ghost = new GhostSprite();
22-
this.add(ghost);
23-
}
24-
25-
public void run() {
26-
this.playSound("bg");
27-
}
3+
public class HalloweenStage extends Stage {
4+
int numberPumpkins = 10;
5+
HouseSprite house;
6+
GhostSprite ghost;
7+
8+
public HalloweenStage() {
9+
super(400, 400);
10+
this.addBackdrop("bg", "sprites/background.jpg");
11+
this.addSound("bg", "sounds/background.wav");
2812

29-
public static void main(String[] args) {
30-
new HalloweenStage();
13+
house = new HouseSprite();
14+
this.add(house);
15+
16+
for (int i = 0; i < numberPumpkins; i++) {
17+
PumpkinSprite p = new PumpkinSprite();
18+
this.add(p);
3119
}
20+
ghost = new GhostSprite();
21+
this.add(ghost);
22+
}
23+
24+
public void run() {
25+
this.playSound("bg");
26+
}
27+
28+
public static void main(String[] args) {
29+
new HalloweenStage();
30+
}
3231
}
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import org.openpatch.scratch.*;
22

3-
public class HouseSprite extends Sprite
4-
{
5-
public HouseSprite() {
6-
this.addCostume("on", "sprites/castle_on.png");
7-
this.addCostume("off", "sprites/castle_off.png");
8-
this.addSound("door", "sounds/door.wav");
9-
this.setSize(70);
10-
this.setY(240);
3+
public class HouseSprite extends Sprite {
4+
public HouseSprite() {
5+
this.addCostume("on", "sprites/castle_on.png");
6+
this.addCostume("off", "sprites/castle_off.png");
7+
this.addSound("door", "sounds/door.wav");
8+
this.setSize(70);
9+
this.setY(240);
10+
}
11+
12+
public void run() {
13+
if (this.isTouchingMousePointer()) {
14+
this.switchCostume("on");
15+
} else {
16+
this.switchCostume("off");
1117
}
12-
13-
public void run() {
14-
if (this.isTouchingMousePointer()) {
15-
this.switchCostume("on");
16-
} else {
17-
this.switchCostume("off");
18-
}
19-
if(isTouchingMousePointer()) {
20-
this.playSound("door");
21-
}
18+
if (isTouchingMousePointer()) {
19+
this.playSound("door");
2220
}
21+
}
2322
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.openpatch.scratch.*;
22

33
public class PumpkinSprite extends AnimatedSprite {
4-
5-
public PumpkinSprite() {
6-
this.addAnimation("idle", "sprites/pumpkin/pumpkin_%02d.png", 2);
7-
this.setAnimationInterval(this.pickRandom(300, 380));
8-
this.setSize(this.pickRandom(5, 15));
9-
this.setTint(this.pickRandom(0, 255));
10-
this.setX(this.pickRandom(0, 960));
11-
this.setY(this.pickRandom(0, 540));
12-
}
13-
14-
public void run() {
15-
this.playAnimation("idle");
16-
}
17-
}
4+
5+
public PumpkinSprite() {
6+
this.addAnimation("idle", "sprites/pumpkin/pumpkin_%02d.png", 2);
7+
this.setAnimationInterval(this.pickRandom(300, 380));
8+
this.setSize(this.pickRandom(5, 15));
9+
this.setTint(this.pickRandom(0, 255));
10+
this.setX(this.pickRandom(0, 960));
11+
this.setY(this.pickRandom(0, 540));
12+
}
13+
14+
public void run() {
15+
this.playAnimation("idle");
16+
}
17+
}
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import org.openpatch.scratch.*;
22

33
public class GhostSprite extends AnimatedSprite {
4-
5-
private int speed = 8;
6-
7-
public GhostSprite() {
8-
this.addAnimation("idle", "sprites/ghost/ghost_%02d.png", 10);
9-
this.addSound("laugh", "sounds/ghost.wav");
10-
this.setSize(70);
4+
5+
private int speed = 8;
6+
7+
public GhostSprite() {
8+
this.addAnimation("idle", "sprites/ghost/ghost_%02d.png", 10);
9+
this.addSound("laugh", "sounds/ghost.wav");
10+
this.setSize(70);
11+
}
12+
13+
public void run() {
14+
if (isKeyPressed(37)) {
15+
this.changeX(-speed);
16+
} else if (isKeyPressed(39)) {
17+
this.changeX(speed);
18+
}
19+
if (isKeyPressed(38)) {
20+
this.changeY(-speed);
21+
} else if (isKeyPressed(40)) {
22+
this.changeY(speed);
1123
}
12-
13-
public void run() {
14-
if(isKeyPressed(37)) {
15-
this.changeX(-speed);
16-
} else if (isKeyPressed(39)) {
17-
this.changeX(speed);
18-
}
19-
if(isKeyPressed(38)) {
20-
this.changeY(-speed);
21-
} else if(isKeyPressed(40)) {
22-
this.changeY(speed);
23-
}
24-
if(isTouchingMousePointer()) {
25-
this.playSound("laugh");
26-
}
27-
this.playAnimation("idle");
24+
if (isTouchingMousePointer()) {
25+
this.playSound("laugh");
2826
}
29-
}
27+
this.playAnimation("idle");
28+
}
29+
}
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
import org.openpatch.scratch.*;
22

3-
public class HalloweenStage extends Stage
4-
{
5-
int numberPumpkins = 10;
6-
HouseSprite house;
7-
GhostSprite ghost;
8-
9-
public HalloweenStage() {
10-
super(400, 400);
11-
this.addBackdrop("bg", "sprites/background.jpg");
12-
this.addSound("bg", "sounds/background.wav");
13-
14-
house = new HouseSprite();
15-
this.add(house);
16-
17-
for (int i = 0; i < numberPumpkins; i++) {
18-
PumpkinSprite p = new PumpkinSprite();
19-
this.add(p);
20-
}
21-
ghost = new GhostSprite();
22-
this.add(ghost);
23-
}
24-
25-
public void run() {
26-
this.playSound("bg");
27-
}
3+
public class HalloweenStage extends Stage {
4+
int numberPumpkins = 10;
5+
HouseSprite house;
6+
GhostSprite ghost;
7+
8+
public HalloweenStage() {
9+
super(400, 400);
10+
this.addBackdrop("bg", "sprites/background.jpg");
11+
this.addSound("bg", "sounds/background.wav");
2812

29-
public static void main(String[] args) {
30-
new HalloweenStage();
13+
house = new HouseSprite();
14+
this.add(house);
15+
16+
for (int i = 0; i < numberPumpkins; i++) {
17+
PumpkinSprite p = new PumpkinSprite();
18+
this.add(p);
3119
}
20+
ghost = new GhostSprite();
21+
this.add(ghost);
22+
}
23+
24+
public void run() {
25+
this.playSound("bg");
26+
}
27+
28+
public static void main(String[] args) {
29+
new HalloweenStage();
30+
}
3231
}
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import org.openpatch.scratch.*;
22

3-
public class HouseSprite extends Sprite
4-
{
5-
public HouseSprite() {
6-
this.addCostume("on", "sprites/castle_on.png");
7-
this.addCostume("off", "sprites/castle_off.png");
8-
this.addSound("door", "sounds/door.wav");
9-
this.setSize(70);
10-
this.setY(240);
3+
public class HouseSprite extends Sprite {
4+
public HouseSprite() {
5+
this.addCostume("on", "sprites/castle_on.png");
6+
this.addCostume("off", "sprites/castle_off.png");
7+
this.addSound("door", "sounds/door.wav");
8+
this.setSize(70);
9+
this.setY(240);
10+
}
11+
12+
public void run() {
13+
if (this.isTouchingMousePointer()) {
14+
this.switchCostume("on");
15+
} else {
16+
this.switchCostume("off");
1117
}
12-
13-
public void run() {
14-
if (this.isTouchingMousePointer()) {
15-
this.switchCostume("on");
16-
} else {
17-
this.switchCostume("off");
18-
}
19-
if(isTouchingMousePointer()) {
20-
this.playSound("door");
21-
}
18+
if (isTouchingMousePointer()) {
19+
this.playSound("door");
2220
}
21+
}
2322
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.openpatch.scratch.*;
22

33
public class PumpkinSprite extends AnimatedSprite {
4-
5-
public PumpkinSprite() {
6-
this.addAnimation("idle", "sprites/pumpkin/pumpkin_%02d.png", 2);
7-
this.setAnimationInterval(this.pickRandom(300, 380));
8-
this.setSize(this.pickRandom(5, 15));
9-
this.setTint(this.pickRandom(0, 255));
10-
this.setX(this.pickRandom(0, 960));
11-
this.setY(this.pickRandom(0, 540));
12-
}
13-
14-
public void run() {
15-
this.playAnimation("idle");
16-
}
17-
}
4+
5+
public PumpkinSprite() {
6+
this.addAnimation("idle", "sprites/pumpkin/pumpkin_%02d.png", 2);
7+
this.setAnimationInterval(this.pickRandom(300, 380));
8+
this.setSize(this.pickRandom(5, 15));
9+
this.setTint(this.pickRandom(0, 255));
10+
this.setX(this.pickRandom(0, 960));
11+
this.setY(this.pickRandom(0, 540));
12+
}
13+
14+
public void run() {
15+
this.playAnimation("idle");
16+
}
17+
}

0 commit comments

Comments
 (0)