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
Discussions
You need to login to take part
Current Discussions
This piece of code does not work.
By Notted, with 25 replies.
Last reply by danpost, almost 7 years ago:
You are confusing the use of your fields. The
spawnBomb
method should only use
bombSpawnTimer
except at the end where it should set
bombSpawnTimer
to
bombSpawnTimerSetter
. The
difficultyRising
method should only deal with
bombSpawnTimerSetter
, reducing its value to increase the bomb spawn rate.
mousePressed isn't working on Greenfoot 3.5.0
By SimonWalls, with no replies.
I'm trying to use mousePressed in the act methode of an object as following: if (Greenfoot.mousePressed(this)) { System.out.println("pressed"); } Everything works great, until I'm changing the cell size in MyWorld from 1 to 50: super(10, 10, 50); Now the mousePressed event for my object isn't firing (stays false). Important: This is working on Greenfoot 3.5.2, but I have to use 3.5.0.
How can I create an array which is public static?
By Kili, with 5 replies.
Last reply by Kili, almost 7 years ago:
Thank you!
How can I check for a valid move in checkers?
By Sedas, with 2 replies.
Last reply by danpost, almost 7 years ago:
Sedas wrote...
I am making a checkers game and currently the player can move the piece to any part of the board, how can I stop this? << Code Omitted >>
The first thing you would need to do is save the original location of the checker so that you can move it back when moved to an illegal square. With that
rx
and
ry
would be unnecessary. Next, thinking logically about how a checker should move, you have blue men moving down and red men moving up. A blue man will always move along the y-axis in a positive direction and a red man in a negative one. The change horizontally
adding the same actor twice/more times
By petyritonel, with 2 replies.
Last reply by petyritonel, almost 7 years ago:
thank you
how can i set background?
By yalamberingnam, with 1 reply.
Replied to by Himsul, almost 7 years ago:
<Code Omitted>
Galton Board School Project
By Janik01, with no replies.
Hi, in our computer science lessons, we have to create the Galton Board with greenfoot. Can anyone help us doing this? Maybe one have this completly? Sorry for bad english. Janik
setting actor's image
By petyritonel, with 8 replies.
Last reply by petyritonel, almost 7 years ago:
danpost wrote...
petyritonel wrote...
how could i change that in the level2 world?
Show code changing worlds.
this reminded me that i should change the picture when setting the new world, not once it's set. thank you.
Help with arrays
By Zestix, with 12 replies.
Last reply by Zestix, almost 7 years ago:
danpost wrote...
Zestix wrote...
I've just confirmed how stupid I am... << Code Omitted >> Of course it won't work if I set new values for rolled everytime
Exactly -- remove lines 4 thru 7. Move line 3 to line 10. Change line 19 to: <Code Omitted>
Thanks!
Displaying all options at random only once
By AOATGS, with 1 reply.
Replied to by danpost, almost 7 years ago:
AOATGS wrote...
I am making a program where I need to show a bunch of names in a 4x5 grid and I have a set list of names that all need to appear once in the list. Is this possible, I have been unable to find any help on it, and I don't have code because I don't know where to start. Any ideas and code is helpful, deadline is Friday February 29th
You could start a new list for the names you have added to the grid. Then, as you iterate thru the set list, if the name is not in your new list, add it to both the grid and the new list.
changing an Actor's Image from a World Class
By xandreas_1, with 11 replies.
Last reply by xandreas_1, almost 7 years ago:
danpost wrote...
xandreas_1 wrote...
Thx a lot! I missed a ( ; ), it missed in youe Code xD
It happens -- sorry.
don't mine your the best :D
How do I stop some actors from passing through other actors?
By JackVolp5, with 1 reply.
Replied to by danpost, almost 7 years ago:
Split horizontal movement from vertical movement. Determine direction along an axis to move before moving. Then apply the 3-step process of move, check for intersectors and move back if any found.
Chess Games
By Fargesia, with 3 replies.
Last reply by danpost, almost 7 years ago:
Fargesia wrote...
how do I create multiple time the same object and delete it later without creating an object for every possible move like I did?
If you are to "highlight" all possible moves for the piece that is to move, it is by necessity that every possible square has its own object that can be clicked on. There are things you can do to help reduce the amount of code needed for that (loops and clever use of Maths, for examples).
game crash because out of memory
By petyritonel, with 2 replies.
Last reply by petyritonel, almost 7 years ago:
I changed a part of it, so now it doesnt have to change worlds that often, it just adds actors, and it fixed it. thanks tho
Declaring a winner out of two players
By MTelesca, with 20 replies.
Last reply by MTelesca, almost 7 years ago:
This worked. Thank you.
208
209
210
211
212
213
214
X