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
How do I add text over multiple lines?
By itssemu, with 4 replies.
Last reply by Yehuda, over 8 years ago:
You cannot put "\" in a String without one of the characters on the bottom of
this page
following it.
Hi! I need help!
By agray11202, with 5 replies.
Last reply by Yehuda, over 8 years ago:
One should not be impolite/ill-mannered/rude to someone, whether that someone is a beginner or not.
How do I get reader's String Input in while running the program?
By cycv5, with 1 reply.
Replied to by Super_Hippo, over 8 years ago:
Try the 'Greenfoot.ask' method.
Changing directions
By Spicy0506, with 3 replies.
Last reply by danpost, over 8 years ago:
Spicy0506 wrote...
when the bikes are going in a direction (lets say right) and I press the left key the bike removes its self. Is there a way to not allow you to go the opposite direction at the specific time.
Add another condition along with the key detection for each direction. For example: <Code Omitted>
How to make a Triangle?
By PlanetUlme03, with 2 replies.
Last reply by danpost, over 8 years ago:
PlanetUlme03 wrote...
<Code Omitted>i found this, but i dont knew how to use it. Could you help me?
For a triangle 'nPoints' would be '3' and 'xPoints' and 'yPoints' would both be int arrays of length 3. Let us say you had an image of size 100x100. To draw a triangle that goes from bottom-left corner to bottom-right corner to top-left corner (back to bottom-left corner), then you have this:
10 Second Timer
By Atebits, with 1 reply.
Replied to by danpost, over 8 years ago:
Atebits wrote...
Im looking to make a basic 10 second timer in my game. The code goes along the lines of whats given below, my issue is knowing how long a second is in this fashion, is it 60 for running at 60fps? Or is it something other? << Code Omitted >>
Actually, it varies depending on the speed of your system. However, in general, at normal running speed, it is around 60 fps. Therefore, initializing your 'time' field to '600' would be about right. Sidenote: it is a bit strange to see a 'while' where an 'if' is sufficient. You could also code act method as follows:
how do i change the name of the Jordan each time the loop runs and adds an object
By itssemu, with 11 replies.
Last reply by itssemu, over 8 years ago:
thank you!!!!
run methode once
By ZiweZhang, with 3 replies.
Last reply by danpost, over 8 years ago:
Change line 10 to: <Code Omitted>
Disable JavaScript version of scenario
By Game/maniac, with 2 replies.
Last reply by Game/maniac, over 8 years ago:
Thank you.
spawning arrows
By doglover555, with 2 replies.
Last reply by danpost, over 8 years ago:
I agree that only one subclass for the arrows is the way to go. I also believe you should have actors for the pads (again, using only one subclass of Actor). The rotation of a pad can be given to any arrow that approaches it and the arrows can be placed into the world at the location of its pad and immediately moved to the other end of the alley so it can begin its approach.
Removing object
By ZiweZhang, with 1 reply.
Replied to by Super_Hippo, over 8 years ago:
This should work: <Code Omitted>
Show only one object of a class after hidden
By Rapoo, with 5 replies.
Last reply by danpost, over 8 years ago:
Instead of using 'clear' on the image, it might be better to set the image of the actor to 'null' <Code Omitted>It can then be easily checked as to whether it is showing or not: <Code Omitted>
Getting error message cannot find symbol - methodCanSee
By IlikeThePrequels, with 2 replies.
Last reply by IlikeThePrequels, over 8 years ago:
Thanks man
Falling Objects
By LarsisYoloo, with 1 reply.
Replied to by Super_Hippo, over 8 years ago:
Create the objects from the act method of the world. Create a random number and check if it is zero, if yes, create a random fruit with a random x value and a y value of 0 (or a bit negative).
Problems with animation integers
By Aura_, with 1 reply.
Replied to by Super_Hippo, over 8 years ago:
What do you think !time++ could do? ! is used to change (a boolean, ) true to false or false to true, ++ is used to increase a variable (for example int) by one. It is not clever to check for keypresses so often. Check it once and then nest the ifs. In the second part, it can't work at all. The conditions in lines 91, 94, 97 and 100 will never be met because they are only checked when the condition in 87 is not met which is part of the condition in the other lines. Animations are easier to handle when you have the images in arrays and simply increase a variable used to hold the current
280
281
282
283
284
285
286
X