Questions tagged [greenfoot]

Greenfoot is an environment that makes it very easy to create 2D animations and games using Java.

Greenfoot is designed for beginners and makes it easy for people who have never programmed before to create games and animations without worrying about dealing with any complexities such as threading, double buffering or swing.

After scenarios have been created they can easily be shared by using the Greenfoot Gallery.

Links:

Main site (download Greenfoot here)

Greenfoot Gallery (users scenarios are published here)

Greenroom (only open to teachers)

128 questions
8
votes
2 answers

Progress bar with 2 Indicators

I want to have progress bar with 2 indicators. One indicator shows progress of task A in color green, the second indicator shows progress of task B in red, all in one progress bar. The rest shows the remaining of tasks A and B. Is there a (simple)…
user1324936
  • 2,187
  • 4
  • 36
  • 49
7
votes
4 answers

Can I develop for Greenfoot using Intellij Idea?

I'm taking a Java course where I have to do some development for Greenfoot. I'm very accustomed to using vim for development in C / C++ and so have been using Intellij Idea with a vim plugin. I despise the Greenfoot IDE. Is it possible to use…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
4
votes
3 answers

Greenfoot/Java - incompatible types: boolean cannot be converted to int

a new user here... and I feel my code is wrong. I'd like to ask for assistance since I am relatively new to the program of Greenfoot. The problem at hand is as stated in the question: I am receiving an "incompatible types" error when compiling my…
Blitz
  • 53
  • 5
3
votes
1 answer

How to get name of the object's from a different class in Java

I am using Greenfoot IDE and i have a World Class and a Boat class and a Exit class Inside the Boat class i have a constructor which defines the boat (what kinda boat it is & which picture). Boat Code: public class Boat extends Actor { private…
user4095898
2
votes
1 answer

Greenfoot Can I create an actor instance in constructors?

I'm using the Greenfoot program to create a game, but cannot instantiate anything in a constructor. For some reason, nothing is made when I write getWorld().addObject() in the constructor. I can create objects in the act() method, though.
Big Chungus
  • 185
  • 1
  • 3
  • 13
2
votes
4 answers

How to make 2 random integers, between 1 and 7, without both being 5?

EDIT: This is a different question to How do I generate random integers within a specific range in Java? because I requested the solution uses the methods public int getRandomNumber(int start,int end) { int normal =…
user5905492
2
votes
2 answers

N amount of boxes within boxes being drawn

Here's what I am trying to replicate: Currently, my code is as follows: public void boxes() { setLocation(20,20); for(int j =0; j < 5; j = j+1) { setLocation(20+50*j,20+50*j); for (int i= 0; i<4; i= i+1) { …
2
votes
1 answer

How to bypass accessDeclaredMembers permission as applet?

I used some code from another question to access the private field "classes" in the Java ClassLoader. This works fine, however when I move it to an applet it gets messed up with this exception: access denied (java.lang.RuntimePermission…
Octavia Togami
  • 4,186
  • 4
  • 31
  • 49
2
votes
1 answer

Greenfoot programming - Actor behavior

I am teaching a class in Greenfoot, and I am stuck over something that seems trivial. I need the option, that whenever someone drags an actor in my world, then drops it a method is triggered. How is this done?
Meir
  • 1,943
  • 5
  • 22
  • 38
1
vote
2 answers

Java Greenfoot, cannot link method between files

Working on a project in school, I'm a beginner to programming and I have big problems with the making of Bubble Shooter, I need to get all of the balls of the map before it changes to map2.. Trying to make it with listing all of the balls but the…
1
vote
1 answer

Greenfoot actor gets removed after compile

I create a new scenario, add new world subclass, add a new actor subclass, then compile. I drag that new actor to the scenario and press the compile button and that actor disappears. Am I missing something here? I hope I am. I'm running this from…
tazboy
  • 1,685
  • 5
  • 23
  • 39
1
vote
1 answer

Remove an Actor in Greenfoot if he´s on the top

I´m building my own Space Invaders in Java with Greenfoot and I have a Spaceship which shoots the Aliens, but the Bullets stop at the top of the map and stay there so I wrote this method which should remove a bullet if it hits the top of the but it…
tino
  • 13
  • 4
1
vote
1 answer

Greenfoot Kara ZigZag code wont work properly

I wanted to write a code for Greenfoot Kara, but my code wont work properly. Please help me debugg it, since im trying it now for 3 Hours straight, but cant get it to work. Heres my code: public class MyKara extends Kara { int evenodd=2; public…
Hytago
  • 11
  • 1
1
vote
1 answer

How would I retrieve the coordinates of my actor subclass in order to place a new actor at the location?

public void move() { //if (this.getWorld().getObjects(Marker.class).isEmpty()) Dog bill = getOneIntersectingObject(Dog.class); Marker bone = getOneIntersectingObject(Dog.class); if (bone == null); { Marker bone= new…
1
vote
0 answers

Implement simple AI for Tank Game (Enemy Turret Rotation, Shooting)

Since i want my game to be singleplayer (Player vs COM) i need a way to tell the Enemy (COM) what to do. For now i implemented a method so that he turns towards the player and shoots when the turret i aligned. But that seems unrealistic and is kind…
1
2 3
8 9