Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
escapecorona
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonathan Malek
escapecorona
Commits
d7687076
Commit
d7687076
authored
4 years ago
by
Simon
Browse files
Options
Downloads
Patches
Plain Diff
platform
parent
a6df44cb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.DS_Store
+0
-0
0 additions, 0 deletions
.DS_Store
Platform.java
+35
-2
35 additions, 2 deletions
Platform.java
Welt.java
+11
-1
11 additions, 1 deletion
Welt.java
project.greenfoot
+20
-13
20 additions, 13 deletions
project.greenfoot
with
66 additions
and
16 deletions
.DS_Store
0 → 100644
+
0
−
0
View file @
d7687076
File added
This diff is collapsed.
Click to expand it.
Platform.java
+
35
−
2
View file @
d7687076
import
greenfoot.*
;
// (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import
java.util.List
;
/**
* Write a description of class Platform here.
*
...
...
@@ -15,6 +15,39 @@ public class Platform extends Interactables
public
void
act
()
{
disappear
();
spawnFaceMask
();
}
public
void
spawnFaceMask
(){
if
(
Greenfoot
.
getRandomNumber
(
100
)
<
5
){
spawnItem
(
new
DispoMask
());
}
else
if
(
Greenfoot
.
getRandomNumber
(
100
)
<
2
){
spawnItem
(
new
DispoMask
());
}
}
public
void
spawnSanitizer
(){}
public
void
spawnToiletPaper
(){}
public
boolean
hasNoItem
(){
List
<
Item
>
items
=
getObjectsAtOffset
(
50
,
50
,
Item
.
class
);
return
items
.
isEmpty
();
}
public
void
spawnItem
(
Item
item
){
if
(
hasNoItem
()){
int
x
=
getX
();
int
y
=
getY
();
getWorld
().
addObject
(
item
,
x
,
y
+
10
);
}
}
}
This diff is collapsed.
Click to expand it.
Welt.java
+
11
−
1
View file @
d7687076
...
...
@@ -27,7 +27,17 @@ public class Welt extends World
public
void
act
()
{
scroll
();
spawnCoronaVirus
();
spawnPlatform
();
}
public
void
spawnPlatform
(){
List
<
Platform
>
platforms
=
getObjects
(
Platform
.
class
);
if
(
platforms
.
isEmpty
()){
int
width
=
WIDTH
-
10
;
int
height
=
Greenfoot
.
getRandomNumber
(
HEIGHT
-
10
);
this
.
addObject
(
new
Platform
(),
width
,
height
);
}
}
public
void
spawnCoronaVirus
(){
...
...
This diff is collapsed.
Click to expand it.
project.greenfoot
+
20
−
13
View file @
d7687076
...
...
@@ -4,6 +4,7 @@ class.Crowd.image=Menschenmenge.png
class.DispoMask.image=Maske.png
class.FaceMask.image=Maske.png
class.GasMask.image=gasmaske.png
class.Platform.image=Unbenannt-2.png
class.Player.image=Player1.png
class.Sanitizer.image=sanitizer.png
class.Spit.image=SpitterSpit.png
...
...
@@ -19,12 +20,18 @@ dependency2.type=UsesDependency
dependency3.from=Welt
dependency3.to=Player
dependency3.type=UsesDependency
editor.fx.0.height=0
editor.fx.0.width=0
editor.fx.0.x=0
editor.fx.0.y=0
height=741
package.numDependencies=3
dependency4.from=Platform
dependency4.to=DispoMask
dependency4.type=UsesDependency
dependency5.from=Platform
dependency5.to=Item
dependency5.type=UsesDependency
editor.fx.0.height=739
editor.fx.0.width=816
editor.fx.0.x=407
editor.fx.0.y=25
height=817
package.numDependencies=5
package.numTargets=19
project.charset=UTF-8
publish.hasSource=false
...
...
@@ -69,17 +76,17 @@ target12.width=80
target12.x=0
target12.y=0
target13.height=50
target13.name=S
pitt
er
target13.name=S
croll
er
target13.showInterface=false
target13.type=ClassTarget
target13.width=80
target13.x=0
target13.y=0
target14.height=50
target14.name=
Interactables
target14.name=
Spitter
target14.showInterface=false
target14.type=ClassTarget
target14.width=
12
0
target14.width=
8
0
target14.x=0
target14.y=0
target15.height=50
...
...
@@ -90,10 +97,10 @@ target15.width=80
target15.x=0
target15.y=0
target16.height=50
target16.name=
Scrol
le
r
target16.name=
Interactab
le
s
target16.showInterface=false
target16.type=ClassTarget
target16.width=
8
0
target16.width=
12
0
target16.x=0
target16.y=0
target17.height=50
...
...
@@ -174,7 +181,7 @@ target9.width=80
target9.x=0
target9.y=0
version=3.0.0
width=1
366
width=1
440
world.lastInstantiated=Welt
xPosition=0
yPosition=2
7
yPosition=2
5
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment