aboutsummaryrefslogtreecommitdiff
path: root/Info/10/2/Baelle/Baelle.json
blob: abcc0dcfdcec53fc7f41003a26b40221dd9e430b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
   "name": "Baelle",
   "id": 982460,
   "modules": [
      {
         "name": "Ball",
         "text": "public class Ball extends Kreis {\n   static final double BESCHLEUNIGUNG = 5;\n   double geschwindigkeit = 0;\n        \n   public Ball(int x, int y, int radius) {\n      super(x, y, radius);\n   }\n    \n   public void act() {\n      double x = getCenterX();\n      double y = getCenterY();\n\n      // Der Ball liegt\n      if(y == 600 - this.getRadius()) {\n         return;\n      }\n\n      // Der Ball faellt\n      geschwindigkeit += BESCHLEUNIGUNG; // Beschleunigung\n      double ny = y + geschwindigkeit;\n      if(ny >= 600 - getRadius()) { // Der Ball ist aufgeschlagen\n         ny = 600 - getRadius();\n         geschwindigkeit = 0;\n      }\n\n      super.SetzePosition(x, ny);\n   }\n}\n\nnew Ball(100, 40, 40);\nnew Flummi(150, 10, 1);\n",
         "identical_to_repository_version": true,
         "is_copy_of_id": null,
         "repository_file_version": null,
         "isFolder": false
      },
      {
         "name": "Kreis",
         "text": "public class Kreis extends Circle\n{\n   String farbe;\n\n   public Kreis(int xPosNeu, int yPosNeu, int radiusNeu) {\n      super(xPosNeu, yPosNeu, radiusNeu);\n      this.FarbeSetzen(\"red\");\n   }\n\n   public void FarbeSetzen(String neueFarbe) {\n      farbe = neueFarbe;\n      this.setFillColor(farbe);\n   }\n\n   public String GibFarbe() {\n      return farbe;\n   }\n\n   public void SetzePosition(double xPosNeu, double yPosNeu) {\n      this.moveTo(xPosNeu, yPosNeu);\n   } \n}\n",
         "identical_to_repository_version": true,
         "is_copy_of_id": null,
         "repository_file_version": null,
         "isFolder": false
      },
      {
         "name": "Flummi",
         "text": "public class Flummi extends Ball {\n   double bounceFaktor;\n    \n   public Flummi(int x, int y, double neuerBounceFaktor) {\n      super(x, y, 20);\n      bounceFaktor = neuerBounceFaktor;\n      super.FarbeSetzen(\"green\");\n   }\n    \n   public void act() {\n      double x = getCenterX();\n      double y = getCenterY();\n\n        // Der Flummi liegt\n      if(y == 600 - getRadius() && geschwindigkeit > 0) {\n         return;\n      }\n        // Der Flummi faellt\n      geschwindigkeit += BESCHLEUNIGUNG; // Beschleunigung\n      double ny = y + (int)geschwindigkeit;\n      if(ny >= 600 - getRadius()) { // Der Flummi ist aufgeschlagen\n         ny = 600 - getRadius();\n         geschwindigkeit = -1 * bounceFaktor * geschwindigkeit;\n      }\n\n      super.SetzePosition(x, ny);\n   }\n}\n",
         "identical_to_repository_version": true,
         "is_copy_of_id": null,
         "repository_file_version": null,
         "isFolder": false
      }
   ],
   "settings": {
      "libraries": []
   },
   "parent_folder_id": 897857,
   "isFolder": false
}