Skip to content

Commit 126c30f

Browse files
committed
fix: pen not behaving like scratch
1 parent 37170bc commit 126c30f

File tree

10 files changed

+260
-62
lines changed

10 files changed

+260
-62
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Changelog
33
index: 4
44
---
55

6+
## 4.8.0
7+
8+
- 💥 BREAKING CHANGE: Pen behavior was changed to work more similar to the behavior of the scratch pen.
9+
- You should double the size of your pen in your sketches to get the same visuals as in the previous versions.
10+
- You should also put the pen down after you have set the initial position, since the pen now draws an initial point, when it is put down.
11+
612
## 4.7.0
713

814
- 🚀 Feat: Add methods to the text class to be more consistent with the sprite class in regard to positioning.

examples/java/RainbowVine/RainbowVine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class LeafSprite extends Sprite {
3737

3838
public LeafSprite(VineSprite vine) {
3939
this.vine = vine;
40-
this.getPen().down();
4140
this.getPen().setSize(2);
4241
this.setDirection(vine.getDirection());
4342
this.getPen().setColor(vine.getPen().getColor());
4443
vine.getPen().changeColor(2);
4544
this.setPosition(vine.getX(), vine.getY());
45+
this.getPen().down();
4646
}
4747

4848
public void run() {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#BlueJ package file
2+
objectbench.height=93
3+
objectbench.width=776
4+
package.divider.horizontal=0.6
5+
package.divider.vertical=0.7995991983967936
6+
package.editor.height=392
7+
package.editor.width=654
8+
package.editor.x=498
9+
package.editor.y=242
10+
package.frame.height=600
11+
package.frame.width=800
12+
package.numDependencies=0
13+
package.numTargets=1
14+
package.showExtends=true
15+
package.showUses=true
16+
readme.height=60
17+
readme.name=@README
18+
readme.width=49
19+
readme.x=10
20+
readme.y=10
21+
target1.height=70
22+
target1.name=RainbowVine
23+
target1.showInterface=false
24+
target1.type=ClassTarget
25+
target1.width=120
26+
target1.x=10
27+
target1.y=110

examples/java/RandomDot/RandomDot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public static void main(String[] args) {
1717
class RandomDotSprite extends Sprite {
1818
public void run() {
1919
if (this.getTimer().everyMillis(100)) {
20-
this.getPen().down();
21-
this.getPen().setSize(10);
20+
this.getPen().up();
21+
this.getPen().setSize(20);
2222
this.goToRandomPosition();
2323
this.getPen().changeColor(2);
24-
this.getPen().up();
24+
this.getPen().down();
2525
}
2626
}
2727
}

examples/java/RandomDot/package.bluej

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#BlueJ package file
2+
objectbench.height=93
3+
objectbench.width=776
4+
package.divider.horizontal=0.6
5+
package.divider.vertical=0.7995991983967936
6+
package.editor.height=392
7+
package.editor.width=654
8+
package.editor.x=494
9+
package.editor.y=151
10+
package.frame.height=600
11+
package.frame.width=800
12+
package.numDependencies=0
13+
package.numTargets=1
14+
package.showExtends=true
15+
package.showUses=true
16+
readme.height=60
17+
readme.name=@README
18+
readme.width=49
19+
readme.x=10
20+
readme.y=10
21+
target1.height=70
22+
target1.name=RandomDot
23+
target1.showInterface=false
24+
target1.type=ClassTarget
25+
target1.width=120
26+
target1.x=10
27+
target1.y=110

examples/java/TimedDot/TimedDot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ public DotSprite() {
2424
super();
2525
this.addTimer("timer2");
2626
this.addTimer("timer1");
27-
this.getPen().setSize(20);
27+
this.getPen().setSize(40);
2828
this.setOnEdgeBounce(true);
2929
this.setDirection(65);
3030
}
3131

3232
public void run() {
3333
if (this.getTimer("timer2").everyMillis(600)) {
34-
this.getPen().down();
3534
this.getPen().setColor(200);
3635
this.move(20);
36+
this.getPen().down();
3737
this.getPen().up();
3838
}
3939
if (this.getTimer("timer1").everyMillis(1200)) {
40-
this.getPen().down();
4140
this.getPen().setColor(100);
4241
this.move(20);
42+
this.getPen().down();
4343
this.getPen().up();
4444
}
4545
}

examples/java/Timer/Timer.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TimerSprite extends Sprite {
1919

2020
public TimerSprite() {
2121
super();
22-
this.getPen().setSize(20);
22+
this.getPen().setSize(40);
2323

2424
this.addTimer("every");
2525
this.addTimer("for");
@@ -34,52 +34,51 @@ public void run() {
3434
int y = -140;
3535
this.x += 20;
3636
if (this.getTimer("every").everyMillis(600)) {
37-
this.getPen().down();
3837
this.getPen().setColor(20);
3938
this.setPosition(this.x, y);
39+
this.getPen().down();
4040
this.getPen().up();
4141
}
4242
y += 40;
4343
if (this.getTimer("for").forMillis(600)) {
44-
this.getPen().down();
4544
this.getPen().setColor(60);
4645
this.setPosition(this.x, y);
46+
this.getPen().down();
4747
this.getPen().up();
4848
}
4949
y += 40;
5050
if (this.getTimer("after").afterMillis(600)) {
51-
this.getPen().down();
5251
this.getPen().setColor(100);
5352
this.setPosition(this.x, y);
53+
this.getPen().down();
5454
this.getPen().up();
5555
}
5656
y += 40;
5757
if (this.getTimer("interval1").intervalMillis(600)) {
58-
this.getPen().down();
59-
6058
this.getPen().setColor(140);
6159
this.setPosition(this.x, y);
60+
this.getPen().down();
6261
this.getPen().up();
6362
}
6463
y += 40;
6564
if (this.getTimer("interval2").intervalMillis(600, true)) {
66-
this.getPen().down();
6765
this.getPen().setColor(180);
6866
this.setPosition(this.x, y);
67+
this.getPen().down();
6968
this.getPen().up();
7069
}
7170
y += 40;
7271
if (this.getTimer("interval3").intervalMillis(600, 300)) {
73-
this.getPen().down();
7472
this.getPen().setColor(220);
7573
this.setPosition(this.x, y);
74+
this.getPen().down();
7675
this.getPen().up();
7776
}
7877
y += 40;
7978
if (this.getTimer("interval4").intervalMillis(600, 300, true)) {
80-
this.getPen().down();
8179
this.getPen().setColor(255);
8280
this.setPosition(this.x, y);
81+
this.getPen().down();
8382
this.getPen().up();
8483
}
8584
}

examples/java/package.bluej

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#BlueJ package file
2+
editor.fx.0.height=0
3+
editor.fx.0.width=0
4+
editor.fx.0.x=0
5+
editor.fx.0.y=0
6+
objectbench.height=93
7+
objectbench.width=1076
8+
package.divider.horizontal=0.6
9+
package.divider.vertical=0.7995991983967936
10+
package.editor.height=392
11+
package.editor.width=940
12+
package.editor.x=472
13+
package.editor.y=131
14+
package.frame.height=600
15+
package.frame.width=1100
16+
package.numDependencies=0
17+
package.numTargets=15
18+
package.showExtends=true
19+
package.showUses=true
20+
project.charset=UTF-8
21+
readme.height=60
22+
readme.name=@README
23+
readme.width=49
24+
readme.x=10
25+
readme.y=10
26+
target1.height=82
27+
target1.name=StressTest
28+
target1.type=PackageTarget
29+
target1.width=120
30+
target1.x=10
31+
target1.y=210
32+
target10.height=82
33+
target10.name=Cat
34+
target10.type=PackageTarget
35+
target10.width=120
36+
target10.x=460
37+
target10.y=170
38+
target11.height=82
39+
target11.name=RandomDot
40+
target11.type=PackageTarget
41+
target11.width=120
42+
target11.x=490
43+
target11.y=60
44+
target12.height=82
45+
target12.name=Pipes
46+
target12.type=PackageTarget
47+
target12.width=120
48+
target12.x=340
49+
target12.y=200
50+
target13.height=82
51+
target13.name=Robot
52+
target13.type=PackageTarget
53+
target13.width=120
54+
target13.x=290
55+
target13.y=320
56+
target14.height=82
57+
target14.name=TimedDot
58+
target14.type=PackageTarget
59+
target14.width=120
60+
target14.x=20
61+
target14.y=130
62+
target15.height=82
63+
target15.name=DonutIO
64+
target15.type=PackageTarget
65+
target15.width=120
66+
target15.x=170
67+
target15.y=210
68+
target2.height=82
69+
target2.name=Shakespeare
70+
target2.type=PackageTarget
71+
target2.width=120
72+
target2.x=570
73+
target2.y=210
74+
target3.height=82
75+
target3.name=Tiled
76+
target3.type=PackageTarget
77+
target3.width=120
78+
target3.x=310
79+
target3.y=0
80+
target4.height=82
81+
target4.name=Sensing
82+
target4.type=PackageTarget
83+
target4.width=120
84+
target4.x=450
85+
target4.y=290
86+
target5.height=82
87+
target5.name=RainbowVine
88+
target5.type=PackageTarget
89+
target5.width=120
90+
target5.x=320
91+
target5.y=90
92+
target6.height=82
93+
target6.name=Saving
94+
target6.type=PackageTarget
95+
target6.width=120
96+
target6.x=10
97+
target6.y=310
98+
target7.height=82
99+
target7.name=Clock
100+
target7.type=PackageTarget
101+
target7.width=120
102+
target7.x=140
103+
target7.y=310
104+
target8.height=82
105+
target8.name=Timer
106+
target8.type=PackageTarget
107+
target8.width=120
108+
target8.x=130
109+
target8.y=10
110+
target9.height=82
111+
target9.name=SmartRocket
112+
target9.type=PackageTarget
113+
target9.width=120
114+
target9.x=170
115+
target9.y=90

resources/build.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Set the java version that should be used to compile your Library.
22

3-
java.target.version=11
3+
java.target.version=17
44

55

66
# Set the description of the Ant build.xml file.
@@ -40,7 +40,7 @@ author.url=https://openpatch.org
4040
# This is NOT a direct link to where to download it.
4141

4242
library.url=https://github.com/openpatch/scratch-for-java
43-
library.version=4.5.0
43+
library.version=4.8.0
4444

4545

4646
# Set the category (or categories) of your Library from the following list:
@@ -73,7 +73,7 @@ source.repository=https://github.com/openpatch/scratch-for-java.git
7373

7474
# Additional information for the generated webpage.
7575

76-
library.copyright=(c) 2023
76+
library.copyright=(c) 2024
7777
library.dependencies=processing-sound
7878
library.keywords=scratch
7979

0 commit comments

Comments
 (0)