-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivision.java
More file actions
109 lines (90 loc) · 3.11 KB
/
Copy pathDivision.java
File metadata and controls
109 lines (90 loc) · 3.11 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Aufteilung here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Division extends Actor
{
/**
* Act - do whatever the Aufteilung wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int ene=0;
int[][] Objekte = new int[15][15];
public void act()
{
wood();
Game gameWorld = (Game) getWorld();
gameWorld.saveObjects(Objekte);
getWorld().removeObject(this);
}
public void wood()
{
int c = 0;
while(c < 100)
{
int x = Greenfoot.getRandomNumber(850) + 100;
int y = Greenfoot.getRandomNumber(850) + 50;
int a,s;
int k,i,j;
k = x/100;
i = x - k*100;
if(i < 50)
{
i = 25 + k*100;
}
else
{
i = 75 + k*100;
}
k = y/100;
j = y - k*100;
if(j < 50)
{
j = 25 + k*100;
}
else
{
j = 75 + k*100;
}
Actor plazierbar = getOneObjectAtOffset(i, j, Bloque.class);
if (i <= 250 && j <= 200 || i >= 800 && j >= 750)
{
}else if (plazierbar == null)
{
int asds = Greenfoot.getRandomNumber(3);
a = (i-175)/50;
s = (j-125)/50;
if(asds==1){
switch(ene){
case 1:
Enemigo theEnemigo1 = new enemigo1();
getWorld().addObject(theEnemigo1, i, j);
Objekte[a][s]=71;
break;
case 2:
Enemigo theEnemigo2 = new enemigo2();
getWorld().addObject(theEnemigo2, i ,j);
Objekte[a][s]=72;
break;
case 3:
Enemigo theEnemigo3 = new enemigo3();
getWorld().addObject(theEnemigo3, i ,j);
Objekte[a][s]=73;
break;
}
ene++;
}else{
Fragil wood = new Fragil();
getWorld().addObject(wood, i, j);
c++;
a = (i-175)/50;
s = (j-125)/50;
Objekte[a][s] = 1;
}
}
}
}
}