Skip to content

Commit ae17f0c

Browse files
committed
v0.3.5-alpha edits
* Changed the amount of creatures per generation to 300 * Fixed #13
1 parent 66562f5 commit ae17f0c

File tree

8 files changed

+14
-6
lines changed

8 files changed

+14
-6
lines changed

source/Creature.pde

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ class Creature {
366366
ScreenNode sn = scn.get ((int) random (scn.size ()));
367367

368368
if (random (1) < 0.2f) { // Slightly adjust the screenNode (1/5 chance)
369-
sn.x = (int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.x;
370-
sn.y = (int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.y;
369+
sn.x = clamp ((int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.x, nodeSize / 2, sizeX - nodeSize / 2);
370+
sn.y = clamp ((int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.y, nodeSize / 2, sizeY - nodeSize / 2);
371371
return;
372372
}
373373

source/GDE.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,10 @@ public boolean betweenIn (float value, int min, int max) {
658658
return value <= max && value >= min;
659659
}
660660

661+
public int clamp (int value, int min, int max) {
662+
return min (max (value, min), max);
663+
}
664+
661665
public void drawPlayer () {
662666
noStroke ();
663667
fill (0, 0, 0);
@@ -1280,8 +1284,8 @@ public void moveScreenNode () {
12801284
ScreenNode sn = scn.get ((int) random (scn.size ()));
12811285

12821286
if (random (1) < 0.2f) { // Slightly adjust the screenNode (1/5 chance)
1283-
sn.x = (int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.x;
1284-
sn.y = (int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.y;
1287+
sn.x = clamp ((int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.x, nodeSize / 2, sizeX - nodeSize / 2);
1288+
sn.y = clamp ((int) random (25) - (random (1) < 0.5f ? 12 : 13) + sn.y, nodeSize / 2, sizeY - nodeSize / 2);
12851289
return;
12861290
}
12871291

@@ -1600,7 +1604,7 @@ public void draw () {
16001604
}
16011605
class Generation {
16021606

1603-
static final int creaturesPerGen = 200; // Amount of creatures per generation (keep even just in case)
1607+
static final int creaturesPerGen = 300; // Amount of creatures per generation (keep even)
16041608
public Creature[] creatures;
16051609

16061610
public Generation () {

source/GDE.pde

+4
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,10 @@ boolean betweenIn (float value, int min, int max) {
642642
return value <= max && value >= min;
643643
}
644644

645+
int clamp (int value, int min, int max) {
646+
return min (max (value, min), max);
647+
}
648+
645649
void drawPlayer () {
646650
noStroke ();
647651
fill (0, 0, 0);

source/Generation.pde

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Generation {
22

3-
static final int creaturesPerGen = 200; // Amount of creatures per generation (keep even just in case)
3+
static final int creaturesPerGen = 300; // Amount of creatures per generation (keep even)
44
public Creature[] creatures;
55

66
public Generation () {

source/Linux32/lib/GDE.jar

80 Bytes
Binary file not shown.

source/Linux64/lib/GDE.jar

80 Bytes
Binary file not shown.

source/Windows32/lib/GDE.jar

80 Bytes
Binary file not shown.

source/Windows64/lib/GDE.jar

80 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)