xxxxxxxxxx
/**
Osu! Mania remade(4k infinite version) in under 100 lines of code
controls: d, f, j, k
the game doesn't work very well in here, it works way better if you copy the code into your IDE and run it from there
feel free to change or copy any of this code :)
**/
ArrayList tile = new ArrayList();
int score=0;
void setup() {
size(400, 600);
}
void draw() {
background(0);
tiles til = new tiles(int(random(0, 3.9)));
fill(#aa0000, 50);
rect(0, 450, 400, 150);
if (frameCount%10==0) { //amount of notes generates per second, frameCount%10=6 notes/second
tile.add(til);
}
fill(#aaaaaa);
rect(40, 0, 20, 600);
rect(140, 0, 20, 600);
rect(240, 0, 20, 600);
rect(340, 0, 20, 600);
for (int i=0; i<tile.size(); i++) {
tiles ta = (tiles) tile.get(i);
ta.run();
ta.display();
ta.move();
if (key=='d'&&ta.location.y>430&&ta.location.x==0.0&&keyPressed) { //d
ta.gone=true;
}
if (key=='f'&&ta.location.y>430&&ta.location.x==100.0&&keyPressed) {//f
ta.gone=true;
}
if (key=='j'&&ta.location.y>430&&ta.location.x==200.0&&keyPressed) {//j
ta.gone=true;
}
if (key=='k'&&ta.location.y>430&&ta.location.x==300.0&&keyPressed) {//k
ta.gone=true;
}
if (ta.location.y>600) {
tile.remove(i);
score=0;
}
if (ta.gone==true) {
score+=ta.location.y>530?30:ta.location.y>480?20:10; //scoring system(you get more points if you do better)
tile.remove(i);
}
}
fill(#0000aa);
textAlign(CENTER);
textSize(50);
text(score, 200, 530);
}
class tiles {
PVector location;
Boolean gone=false;
tiles(int i) {
location = new PVector(i*100, 0);
}
void run() {
display();
move();
}
void display() {
fill(location.x==0?#00aaaa:location.x==100?#00aa00:location.x==200?#aaaa00:#aa00aa);
rect(location.x, location.y, 100, 50, 40);
}
void move() {
location.y+=5; //note speed, changing this will up the difficulity, putting it too high will make
} //it literally impossible
}