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
moving side to side
By Topben107, with 4 replies.
Last reply by danpost, almost 6 years ago:
With fields: <Code Omitted>you can use: <Code Omitted>to move; and: <Code Omitted>to deflect off other actors.
separate actor
By JohnBis, with 1 reply.
Replied to by danpost, almost 6 years ago:
JohnBis wrote...
i want to separate my two actor of same class with exact same distance.
Show code of class with attempted codes pointed out. Then give very detailed explanation of what you are trying to do.
Movement keys
By Mpache02, with 1 reply.
Replied to by danpost, almost 6 years ago:
Insufficient amount of code provided. Please provide, at minimum, the entire method.
Scrolling level
By papst, with 1 reply.
Replied to by danpost, almost 6 years ago:
Please refer to my
Scrolling Tutorial
scenario.
How to choose 4 blocks ?
By Nurnail, with 1 reply.
Replied to by danpost, almost 6 years ago:
I would go about it a totally different way. I would have mouse clicking on
Pick
objects toggle the existence of its reference being in a
public static
List
in the
Pick
class. Then have the world
act
pick one when the list contains four elements (clearing the list afterwards). I am quite sure controlling the images would also be quite simple then (although I cannot see how the initial images are set). Other than the
static List
, the only other field required would be an
int id
to indicate which type item the
Pick
instance is. In all,
NEED SOME URGENT HELP
By imran.ahmad, with 1 reply.
Replied to by danpost, almost 6 years ago:
imran.ahmad wrote...
I need to put above image on my program in the beginning. I am able to figure how to start the game. But I am not able to figure out how to open the Help page and exit the game? Can you guys help me out.Need quick response
Add an act method to check and respond to possible keys:
Background colour collision detection help
By -----Sam-----, with 1 reply.
Replied to by danpost, almost 6 years ago:
It would probably help to first get the x and y offsets for the direction moving/facing: <Code Omitted>Now you can get the world background and compare the color at (getX()+dx*getImage().getWidth()/2, getY()+dy*getImage().getHeight()/2) to Color.BLACK. The color checking will need to be done for each case of moving direction.
Scroller Displacement Problems
By treykrizek03, with 5 replies.
Last reply by danpost, almost 6 years ago:
treykrizek03 wrote...
how I would be able to get the Player to spawn back into the world at the correct checkpoint after falling off of it ... the coordinates of the objects got displaced, so the Player isn't getting set to the correct location.)
You will need to make use of
getScrollX
and
getScrollY
. I guess one way to handle it is to negate the scrolled amount (un-scroll back to initial position), then add the player back in. Another is to subtract the scrolled amounts from the coordinates where you want the player.
Forcing the Mouse
By Brandman73, with 1 reply.
Replied to by danpost, almost 6 years ago:
I would presume that the code in
Mouse Trap
by
Bourne
would provide a decent example.
score counter
By JohnBis, with 1 reply.
Replied to by danpost, almost 6 years ago:
JohnBis wrote...
Can i create score counter which add score between (480,600) to (520,600) ?
Are those amounts in the hundred thousands or world coordinate pairs? Also, please show attempted codes. It can go a long way in at least showing what you are trying to accomplish.
plz help me
By Roshan123, with 1 reply.
Replied to by danpost, almost 6 years ago:
You want to ask about two distinct conditions such that if BOTH are satisfied, then execute some specific code. That is a logical AND operation (if condition (a) AND if condition (b) ...: <Code Omitted>The "
&&
" is the logical AND operator and "
||
" is the logical OR operator.
Is there any other way to get user keyboard input than getKey and isKeyDown?
By mshep, with 2 replies.
Last reply by mshep, almost 6 years ago:
Makes sense. Thanks a lot!
I need help, submitting this today for AP CSP!
By lucasstan, with 1 reply.
Replied to by danpost, almost 6 years ago:
Apparently, you need a String type argument: <Code Omitted>
Printing an image in another class
By SnowFlurry, with 5 replies.
Last reply by danpost, almost 6 years ago:
SnowFlurry wrote...
Thanks! That does make the text print in a visible place, but it still only prints when called from the Text class, calling the textBox() method from the main class still does not make the code print the image... I'm stumped.
Show main class codes with attempt.
shapes
By Roshan123, with 2 replies.
Last reply by Roshan123, almost 6 years ago:
ok, thanks for reply
121
122
123
124
125
126
127
X