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
Error trying to make colour detection
By Underdemon, with 3 replies.
Last reply by danpost, over 7 years ago:
Underdemon wrote...
I removed cLevel so checkFall is now this: << Code Omitted >> but this "
==("FF00FF00")"
throws up the error "incomparable types: int and java.lang.String", which i don't understand how i would fix it and if i use .equals instead, it says int cannot be dereferenced. (Line 6)
You should probably remove the second import line and just compare the color, using
equals
, to
Color.GREEN
: <Code Omitted>You can also remove line 5 in your last code post.
nullPointerExecption error for hit detection
By Notted, with 22 replies.
Last reply by danpost, over 7 years ago:
Notted wrote...
I just did and it works. I think that's due to how Java reads calls.
No. It is due to your
wallCollapse
method removing the actor and then your
wallTakesAHit
method using
getWorld
, which would then be
null
.
Decreasing Sroller World of Danpost
By xandreas_1, with 7 replies.
Last reply by danpost, over 7 years ago:
xandreas_1 wrote...
yes absolutly right
What you are doing is misplacing the behavior of the car and putting it on the scrolling. It would be better to control the car with the keys, allowing it to be moved along the x-axis, then have the scrolling be determined by the amount the car moved along the x-axis, moving the car back to its original horizontal location. That would be actor follow scrolling code with some ranged actor movement (along the y-axis). See my tutorial on this.
Refrence two get object commands
By BlueSnake, with 4 replies.
Last reply by BlueSnake, over 7 years ago:
Ok, thank you that makes sense
How to make detection area of sprites larger than 1.
By KWAKamole, with 2 replies.
Last reply by danpost, over 7 years ago:
KWAKamole wrote...
I am working on a tetris game, and all of the tetrominos are 4 blocks in size in their respective shapes. However, Greenfoot automatically makes all of the detection areas for boundaries and all of the "touching methods" the one block in the middle of the entire sprite, disallowing me to make them stack on one another. How can I either 1) change their boundaries(to make them stop when they touch) or 2) protect for it some other way?
An easy way is to use 4 square blocks for each tetromino. These blocks can be used for collision detection for the unit as a whole. I w
how do i make a actor spawn an actor? like i used the "addObject()" but it said variable not found i have a class for it tho so idk
By ttkaigler, with 3 replies.
Last reply by danpost, over 7 years ago:
ttkaigler wrote...
oooooooh ok thank you very much. but also wouldnt i do an timer to despawn the attack? << Code Omitted >>
The timer you refer to can be placed in the class of the actor itself.
check which image has the character
By CodeMaster1234, with 4 replies.
Last reply by CodeMaster1234, over 7 years ago:
can you help me a little more like i have to chech image of actor1 in actor2 editor, Where should i write these codes and which is actor1 and which is actor2? sorry i m a begginer. :((
Greenfoot executable doesn't work
By iminblue, with 5 replies.
Last reply by Andrew.2, over 7 years ago:
dont swearo at meo in chenesooo
This piece of code does not work.
By Notted, with 25 replies.
Last reply by danpost, over 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, over 7 years ago:
Thank you!
How can I check for a valid move in checkers?
By Sedas, with 2 replies.
Last reply by danpost, over 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, over 7 years ago:
thank you
how can i set background?
By yalamberingnam, with 1 reply.
Replied to by Himsul, over 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
209
210
211
212
213
214
215
X