This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
What is happening right now?
Latest Scenarios
BinaryGame
NOVA-RUN
Casino
Pengu
Retro Coders
Project Space H...
more
Popular Scenarios
wizard_advanture
Sonic The FartHog
STARFALL
Meeresszenario_...
Get That Pizza!...
Gundala Adventure
more
Popular Users
more
Popular Collections
Optical Illusions
Reusable actors...
Scenario showcase
Demos by danpost
more
New Scenario: BinaryGame
By ostvest - about 4 hours ago
Test your binary convertion knowledge
New Scenario: NOVA-RUN
By ostvest - about 4 hours ago
Platformer game for a school project
Update: Casino
By EierVogelGame - about 14 hours ago
Comment on Pengu
By Nosson1459 - about 19 hours ago
finally got around to fixing this
Update: Pengu
By Nosson1459 - about 19 hours ago
Platform Jumper
New Scenario: Retro Coders
By aluno.tech4me - about 21 hours ago
testing
By hafizz.hnn, with no replies.
import greenfoot.*; public class MyWorld extends World { public MyWorld() { super(800, 600, 1); // Spawn 50 orang normal for (int i = 0; i < 50; i++) { addObject( new People(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight()) ); } // Spawn 1 orang infected secara random People infected = new People(); infected.setInfected(true); addObject(infected,Greenfoot.getRandomNumber(getWidth()),Greenfoot.getRandomNumber(getHeight())); // Spawn ambulance addObject(new Ambulance(), 0, 0); } } ============================================= import greenfoot.*; public class Ambulance extends Actor { private int speed = 5; private int stepDown = 30; private boolean movingRight = true; public void act() { moveZigZag(); healPeople(); } private void moveZigZag() { if (movingRight) { setLocation(getX() + speed, getY()); if (getX() >= getWorld().getWidth() - 1) { movingRight = false; setLocation(getX(), getY() + stepDown); } } else { setLocation(getX() - speed, getY()); if (getX() <= 0) { movingRight = true; setLocation(getX(), getY() + stepDown); } } // Jika sudah mencapai bawah, kembali ke atas if (getY() >= getWorld().getHeight() - 1) { setLocation(getX(), 0); } } private void healPeople() { People p = (People)getOneIntersectingObject(People.class); if (p != null && p.isInfected()) { p.setInfected(false); } } } ===================================================== import greenfoot.*; import java.util.List; public class People extends Actor { private boolean infected = false; private boolean immune = false; private int infectionTimer = 0; public People() { updateImage(); } public void act() { randomMove(); if (infected) { spreadInfection(); infectionTimer++; if (infectionTimer >= 200) { setImmune(true); } } } // Gerak random private void randomMove() { move(4); if (Greenfoot.getRandomNumber(100) < 20) { turn(Greenfoot.getRandomNumber(61) - 30); } if (isAtEdge()) { turn(180); } } // Menularkan ke orang yang disentuh private void spreadInfection() { List<People> people = getIntersectingObjects(People.class); for (People p : people) { if (p != this && !p.isImmune() && !p.isInfected()) { p.setInfected(true); } } } // Mengubah status infected public void setInfected(boolean status) { if (immune) return; infected = status; if (infected) { infectionTimer = 0; } else { infectionTimer = 0; } updateImage(); } public boolean isInfected() { return infected; } // Mengubah menjadi immune public void setImmune(boolean status) { immune = status; if (immune) { infected = false; infectionTimer = 0; } updateImage(); } public boolean isImmune() { return immune; } // Mengganti gambar sesuai status private void updateImage() { if (immune) { setImage("immune.png"); } else if (infected) { setImage("infected.png"); } else { setImage("normal.png"); } } }
Space Haven Project
By schaeff_lu, with no replies.
hallo mein Project ist nicht in der richtigen Größe was kann ich tun um es zu spielen
Update: Project Space Haven
By schaeff_lu - 1 day ago
Indie Space Shooter developed in Informatik
Update: Mondlandung_leer
By drguenther - 6 days ago
New Scenario: Kotiki
By Andrii - 7 days ago
New Scenario: Batalha Naval
By Alexandrepmiranda2626 - 8 days ago
X
Comment on Pengu