mirror of
https://github.com/Stefan-5422/School-Programming-Projekt-022022.git
synced 2026-09-04 00:46:01 +02:00
Add complexity based on level
The complexity is artificial, but its good enougj
This commit is contained in:
@@ -3,6 +3,7 @@ package com.yes.yes.managers;
|
|||||||
import com.yes.yes.entities.parts.Square;
|
import com.yes.yes.entities.parts.Square;
|
||||||
import com.yes.yes.utils.GlobalEventHandler;
|
import com.yes.yes.utils.GlobalEventHandler;
|
||||||
import com.yes.yes.utils.Item;
|
import com.yes.yes.utils.Item;
|
||||||
|
import com.yes.yes.utils.NoiseGenerator;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
|
||||||
public class HubManager {
|
public class HubManager {
|
||||||
@@ -32,15 +33,37 @@ public class HubManager {
|
|||||||
|
|
||||||
|
|
||||||
private Item generateObjective() {
|
private Item generateObjective() {
|
||||||
|
|
||||||
|
NoiseGenerator n;
|
||||||
|
|
||||||
Item item = new Item();
|
Item item = new Item();
|
||||||
|
|
||||||
int layerCount = (level / 10) + 1;
|
int layerCount = (level / 10) + 1;
|
||||||
int complexity = level % 10; //TODO: Make complexity make stuff more complex
|
int complexity = (level % 10) + Math.min(layerCount-1,3) * 3;
|
||||||
|
|
||||||
for (int l = 0; l < layerCount && l < 4; l++) {
|
for (int l = 0; l < layerCount && l < 4; l++) { //Find a way to balance this better
|
||||||
|
int color = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
item.setPart(l, i, new Square(Color.RED));
|
double noise = NoiseGenerator.calculate(complexity*level+layerCount+(i+1)*(l+1))/1e8;
|
||||||
item.setPart(0, i, new Square(Color.GREEN));
|
System.out.println(noise);
|
||||||
|
if(complexity >= 3 && complexity < 5){
|
||||||
|
if(noise > 10) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}else if(complexity > 5) {
|
||||||
|
if(noise > 15-layerCount) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(complexity > 1 && complexity < 4 && (i == 0 || i == 2)){
|
||||||
|
color = ((int)(noise/1.5))%3;
|
||||||
|
}
|
||||||
|
if(complexity > 4){
|
||||||
|
color = ((int)(noise/1.5))%3;
|
||||||
|
}
|
||||||
|
Color c = (color == 0)? Color.RED : (color==1)? Color.GREEN : Color.BLUE;
|
||||||
|
item.setPart(l, i, new Square(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
|||||||
Reference in New Issue
Block a user