Anden version af koden - RealMrMario/Tank_game GitHub Wiki
Mover m;
PVector g = new PVector(0, 0.1);
String s = "FULL POWER"; String s2 = "0% POWER"; String s3 = "CLICK TO SHOOT"; void setup() { size(1920, 900);
}
void mouseReleased() {
m = new Mover(); PVector f = new PVector(mouseX,-(height - mouseY)); println(f); //float ma = log(f.mag()*100); //f.normalize(); f.mult(0.02);//ma); m.update(f);
}
void draw() {
clear(); stroke(255); text(s3,960,900,100,100); text(s,980,30,50,50); text(s2,30,60,50,50); line(0,900,mouseX,mouseY); rect(0,20,mouseX,20);
if (m != null) {
m.display(); m.update(g);}
}