Superclass "Curven" terug naar de inleiding
class Curven {
float xa1, ya1, xa2, ya2, xa3, ya3, xa4, ya4;
float xc1, yc1, xc2, yc2, xc3, yc3, xc4, yc4, xc5, yc5, xc6, yc6;
color c;
//variabelen gebruikt in de superclass
float yc3snelhUp = 2;
float yc2snelhDown = 2;
float ya1snelhUp = 2, ya2snelhUp = 2, ya3snelhUp = 2, ya4snelhUp = 2;
float ya1snelhDown = 2, ya2snelhDown = 2, ya3snelhDown = 2, ya4snelhDown = 2;
float xa1snelhRe = 2, xa2snelhRe = 2, xa3snelhRe = 2, xa4snelhRe = 2;
float xa1snelhLi = 2, xa2snelhLi = 2, xa3snelhLi = 2, xa4snelhLi = 2;
float xya1snelhLiOn = 2, xya1snelhLiBo = 2, xya1snelhReOn = 2, xya1snelhReBo = 2;
float xya2snelhLiOn = 2, xya2snelhLiBo = 2, xya2snelhReOn = 2, xya2snelhReBo = 2;
float xya3snelhLiOn = 2, xya3snelhLiBo = 2, xya3snelhReOn = 2, xya3snelhReBo = 2;
//De lege constructor
Curven() {
}
//De lege display methode
void display() {
}
//de beweginsmethodes
//beweging in x richting
void xa1Re() {
xa1 = xa1 + xa1snelhRe;
if ((xa1 > width) || (xa1 < 0)) {
xa1snelhRe = xa1snelhRe * -1;
}
}
void xa2Re() {
xa2 = xa2 + xa2snelhRe;
if ((xa2 > width) || (xa2 < 0)) {
xa2snelhRe = xa2snelhRe * -1;
}
}
void xa3Re() {
xa3 = xa3 + xa3snelhRe;
if ((xa3 > width) || (xa3 < 0)) {
xa3snelhRe = xa3snelhRe * -1;
}
}
void xa4Re() {
xa4 = xa4 + xa4snelhRe;
if ((xa4 > width) || (xa4 < 0)) {
xa4snelhRe = xa4snelhRe * -1;
}
}
void xa1Li() {
xa1 = xa1 - xa1snelhLi;
if ((xa1 > width) || (xa1 < 0)) {
xa1snelhLi = xa1snelhLi * -1;
}
}
void xa2Li() {
xa2 = xa2 - xa2snelhLi;
if ((xa2 > width) || (xa2 < 0)) {
xa2snelhLi = xa2snelhLi * -1;
}
}
void xa3Li() {
xa3 = xa3 - xa3snelhLi;
if ((xa3 > width) || (xa3 < 0)) {
xa3snelhLi = xa3snelhLi * -1;
}
}
void xa4Li() {
xa4 = xa4 - xa4snelhLi;
if ((xa4 > width) || (xa4 < 0)) {
xa4snelhLi = xa4snelhLi * -1;
}
}
//Bewegingen in yaUp richting
void ya1Up() {
ya1 = ya1 - ya1snelhUp;
if ((ya1 > height) || (ya1 < 0)) {
ya1snelhUp = ya1snelhUp * -1;
}
}
void ya2Up() {
ya2 = ya2 - ya2snelhUp;
if ((ya2 > height) || (ya2 < 0)) {
ya2snelhUp = ya2snelhUp * -1;
}
}
void ya3Up() {
ya3 = ya3 - ya3snelhUp;
if ((ya3 > height) || (ya3 < 0)) {
ya3snelhUp = ya3snelhUp * -1;
}
}
void ya4Up() {
ya4 = ya4 - ya4snelhUp;
if ((ya4 > height) || (ya4 < 0)) {
ya4snelhUp = ya4snelhUp * -1;
}
}
//bewegingen in yaDown richting
void ya1Down() {
ya1 = ya1 + ya1snelhDown;
if ((ya1 > height) || (ya1 < 0)) {
ya1snelhDown = ya1snelhDown * -1;
}
}
void ya2Down() {
ya2 = ya2 + ya2snelhDown;
if ((ya2 > height) || (ya2 < 0)) {
ya2snelhDown = ya2snelhDown * -1;
}
}
void ya3Down() {
ya3 = ya3 +ya3snelhDown;
if ((ya3 > height) || (ya3 < 0)) {
ya3snelhDown =ya3snelhDown * -1;
}
}
void ya4Down() {
ya4 = ya4 +ya4snelhDown;
if ((ya4 > height) || (ya4 < 0)) {
ya4snelhDown =ya4snelhDown * -1;
}
}
void yc2Down() {
yc2= yc2 + yc2snelhDown;
if ((yc2 > height) || (yc2 < 0)) {
yc2snelhDown = yc2snelhDown * -1;
}
}
void yc3Up() {
yc3 = yc3 - yc3snelhUp;
if ((yc3 > height) || (yc3< 0)) {
yc3snelhUp = yc3snelhUp * -1;
}
}
//bewegingen naar rechts- en linksboven
void xya1ReBo() {
xa1 = xa1 + xya1snelhReBo;
if ((xa1 > width) || (xa1 < 0)) {
xya1snelhReBo = xya1snelhReBo * -1;
}
ya1 = ya1 - xya1snelhReBo;
if ((ya1 > height) || (ya1 < 0)) {
xya1snelhReBo = xya1snelhReBo * -1;
}
}
void xya2ReBo() {
xa2 = xa2 + xya2snelhReBo;
if ((xa2 > width) || (xa2 < 0)) {
xya2snelhReBo = xya2snelhReBo * -1;
}
ya2 = ya2 - xya2snelhReBo;
if ((ya2 > height) || (ya2 < 0)) {
xya2snelhReBo = xya2snelhReBo * -1;
}
}
void xya3ReBo() {
xa3 = xa3 + xya3snelhReBo;
if ((xa3 > width) || (xa3 < 0)) {
xya3snelhReBo = xya3snelhReBo * -1;
}
ya3 = ya3 - xya3snelhReBo;
if ((ya3 > height) || (ya3 < 0)) {
xya3snelhReBo = xya3snelhReBo * -1;
}
}
void xya1LiBo() {
xa1 = xa1 - xya1snelhLiBo;
if ((xa1 > width) || (xa1 < 0)) {
xya1snelhLiBo = xya1snelhLiBo * -1;
}
ya1 = ya1 - xya1snelhLiBo;
if ((ya1 > height) || (ya1 < 0)) {
xya1snelhLiBo = xya1snelhLiBo * -1;
}
}
void xya2LiBo() {
xa2 = xa2 - xya2snelhLiBo;
if ((xa2 > width) || (xa2 < 0)) {
xya2snelhLiBo = xya2snelhLiBo * -1;
}
ya2 = ya2 - xya2snelhLiBo;
if ((ya2 > height) || (ya2 < 0)) {
xya2snelhLiBo = xya2snelhLiBo * -1;
}
}
void xya3LiBo() {
xa3 = xa3 - xya3snelhLiBo;
if ((xa3 > width) || (xa3 < 0)) {
xya3snelhLiBo = xya3snelhLiBo * -1;
}
ya3 = ya3 - xya3snelhLiBo;
if ((ya3 > height) || (ya3 < 0)) {
xya3snelhLiBo = xya3snelhLiBo * -1;
}
}
//bewegingen naar links- en rechtsonder
void xya1LiOn() {
xa1 = xa1 - xya1snelhLiOn;
if ((xa1 > width) || (xa1 < 0)) {
xya1snelhLiOn = xya1snelhLiOn * -1;
}
ya1 = ya1 + xya1snelhLiOn;
if ((ya1 > height) || (ya1 < 0)) {
xya1snelhLiOn = xya1snelhLiOn * -1;
}
}
void xya2LiOn() {
xa2 = xa2 - xya2snelhLiOn;
if ((xa2 > width) || (xa2 < 0)) {
xya2snelhLiOn = xya2snelhLiOn * -1;
}
ya2 = ya2 + xya2snelhLiOn;
if ((ya2 > height) || (ya2 < 0)) {
xya2snelhLiOn = xya2snelhLiOn * -1;
}
}
void xya3LiOn() {
xa3 = xa3 - xya3snelhLiOn;
if ((xa3 > width) || (xa3 < 0)) {
xya3snelhLiOn = xya3snelhLiOn * -1;
}
ya3 = ya3 + xya3snelhLiOn;
if ((ya3 > height) || (ya3 < 0)) {
xya3snelhLiOn = xya3snelhLiOn * -1;
}
}
void xya1ReOn() {
xa1 = xa1 + xya1snelhReOn;
if ((xa1 > width) || (xa1 < 0)) {
xya1snelhReOn = xya1snelhReOn * -1;
}
ya1 = ya1 + xya1snelhReOn;
if ((ya1 > height) || (ya1 < 0)) {
xya1snelhReOn = xya1snelhReOn * -1;
}
}
void xya2ReOn() {
xa2 = xa2 + xya2snelhReOn;
if ((xa2 > width) || (xa2 < 0)) {
xya2snelhReOn = xya2snelhReOn * -1;
}
ya2 = ya2 + xya2snelhReOn;
if ((ya2 > height) || (ya2 < 0)) {
xya2snelhReOn = xya2snelhReOn * -1;
}
}
void xya3ReOn() {
xa3 = xa3 + xya3snelhReOn;
if ((xa3 > width) || (xa3 < 0)) {
xya3snelhReOn = xya3snelhReOn * -1;
}
ya3 = ya3 + xya3snelhReOn;
if ((ya3 > height) || (ya3 < 0)) {
xya3snelhReOn = xya3snelhReOn * -1;
}
}
}