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
1
vote
1 answer

Do not understand Java MouseInfo code in Greenfoot

I don't quite get how this bit of code works. I understand the outcome (to add a new object using the mouse coordinates), but can you explain to me how the lines beginning with 'MouseInfo...' and 'addObject..' work? Is a new MouseInfo object created…
0
votes
1 answer

Greenfoot and Native Java Classes

I am trying to import java.awt.*; into my class in Greenfoot but when I call a method, paintComponent(), I get an error saying that the method was not found. The Greenfoot website states that native classes must be imported manually…
Shahmeer Navid
  • 566
  • 4
  • 10
  • 18
0
votes
1 answer

Get information about array containing object - Java

I have a bunch of objects in an array in Greenfoot, when act(loop that keeps game going) runs I need to get some information about the array from within the object that belongs to it. What ways are there for getting information about the array from…
nenne
  • 165
  • 2
  • 9
0
votes
1 answer

Need help to do a array to Snake game in Greenfoot

Got a new task in School to code the Snake Game from scratch and need to use a array to add a new Snake bodypart when the Snakehead eats food and at the beginning the Snake need to have 1 head and 2 bodyparts..and I have no idea how to do this..can…
0
votes
1 answer

I need to execute this Pseudocode in java

I have these two methods given called leftEyeColor() and rightEyeColor(). And in each of those methods, I must execute this pseudocode: For leftEyeColor and rightEyeColor methods: Get world Get background Get x and y…
0
votes
0 answers

Java Greenfoot error in class with no error indication

Greenfoot tells me there is an error in the code, but doesn't show me any indication of an error, so it can't be a syntax issue. I tried playing around with the brackets and I restarted Greenfoot, nothing helps. I am trying to do a simple program…
0
votes
1 answer

Netlogo Vs Greenfoot

I am looking for a software tool that will introduce me to the basics of modeling and simulation. I have a good working knowldge of C++ and Java. Could someone tell me the differences between NetLogo and Greenfoot? Which of these would you…
Hop
  • 1
  • 2
0
votes
1 answer

Create smooth gradient with HSB in java

I'm trying to create a sorting algorithm visualiser in greenfoot java, with an array shown as a column graph. I want it to be colourful, so I'm using a colour gradient like shown in this video https://www.youtube.com/watch?v=qlvBsYyGIDo This is the…
Amber Cahill
  • 106
  • 8
0
votes
1 answer

Cannot access greenfoot.World - class file has wrong version

I try to use Intellij IDEA for Greenfoot development on Mac. Here is a tutorial to use NetBeans with Greenfoot: https://www.greenfoot.org/doc/running_on_netbeans So I created my scenario in Greenfoot. Then saved it and opened it in IDEA. I took…
Kirill Ch
  • 5,496
  • 4
  • 44
  • 65
0
votes
2 answers

How to change images of other objects?

I am using a program called Greenfoot to do my java projects. there is two "actors" in Greenfoot that move around randomly. I would like to make it so that when one actor touches the other, it has a percent of…
Octavia Togami
  • 4,186
  • 4
  • 31
  • 49
0
votes
0 answers

I get a nullPointerException calling a function from some methods and not from others

I'm using an environment called Greenfoot, a simple Java based 2d game engine, however I do not think the issue is related to Greenfoot, but java in general. In Greenfoot, there is a World class, in which all of the Actors (just objects) interact…
0
votes
0 answers

Greenfoot play sound if an object of class type is getting closer with a distance to another class object

I am working on a simple car game on greenfoot and I wanna add an alert sound if my car is getting closer to a truck This was my trial in the truck class's act method but it keeps on showing an exception: if(!getObjectsInRange(60,…
Mind
  • 9
  • 2
0
votes
1 answer

Run a game on two computers?

I am creating a two-sided war game using Greenfoot. I would like to play it with my brother but I would also like my brother to be able to see only one part of the whole map and me too. Hence, I would like my brother to be able to play it on his…
SomeProgrammer
  • 1,134
  • 1
  • 6
  • 12
0
votes
1 answer

Problem with statement and level progression

I'm tasked with creating a java game in Greenfoot. I would like to collect 5 coins, a door appears, you enter the door, next level. I've done that so far. There's a problem with this if/else statement I think: if (coinsCollected == 5 && levelCounter…
user11703461
0
votes
0 answers

I'm having trouble collecting 5 coins and successfully going to next world

So we recently started coding in college and I'm having trouble with my game in Greenfoot. I should normally be able to collect 5 coins on level 1, go to the door, and progress to level 2 and so on... This is my piece of code so far: private…
user11703461
1 2
3
8 9