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
Switching between Worlds
By ihjufaeshiju, with 2 replies.
Last reply by ihjufaeshiju, over 6 years ago:
Thanks, this worked very nicely.
Reflection law calculate new direction (Tank Game)
By SushiLlama, with 32 replies.
Last reply by SushiLlama, over 6 years ago:
Tried all of them. It made the amount of disappearing shells even larger, im afraid.
danpost wrote...
See if a larger value than 99 (and -99) will do the trick. Try 100, 150, 199 (I would not think more than 199 would be needed. The initial 99 was for the fact that the QActor is not placed at its Q-location (cannot be placed between pixels on the screen). The additional amount I am suggesting now is for the change in rotation of the actor (the center of the image along an even sized dimension is a half pixel off from where the actor is actually placed on the screen). These values are on the
Animation
By Hundmat, with 1 reply.
Replied to by danpost, over 6 years ago:
Hundmat wrote...
I have seen several ways to animate images in greenfoot, but which is the most convenient way of coding it. Right now I'm using this << Code Omitted >>
Convenient? ... probably what you have is most convenient for you. However, convenient is not necessarily best. Use of the array is an excellent choice. Using a double value for an integer index does not seem appropriate. In fact, it is not possible for a computer to store the value of one-fifth exactly. And, although it may seem like a moot point, computations using double values takes longer than when using int v
Newtons Project - Greenfoot Textbook
By VanishingDog, with 1 reply.
Replied to by danpost, over 6 years ago:
Use get
K
ey instead of
isKeyDown
. It could start as follows: <Code Omitted>Do not put your line 146 in the loop.
How to make a ball bounce back from a object?
By ouyoood, with 1 reply.
Replied to by danpost, over 6 years ago:
Try this: <Code Omitted>
move, turn, move down, turn and repeat that movement until it hits a corner
By thatonegirl, with 4 replies.
Last reply by danpost, over 6 years ago:
thatonegirl wrote...
I don't know how to check edges though, I know you use getHeight() but that's it. Could you show it to me?
My line 2 above checks for left and right edges (at the same time). Your line 39 checks for path completion (lower-left corner) and it does use
getHeight
. Those are the main position checks you need.
Code for swiping and tapping at touch screen
By Higgins1904, with 4 replies.
Last reply by Higgins1904, over 6 years ago:
My plan is to run my program at a Raspberry Pi 4 with a 7" or 10 " touch screen, so it will in effect by quite similar to a pad. Will dive into your demo now!
Broken application language/translation
By MbahX, with 2 replies.
Last reply by MbahX, over 6 years ago:
i've already editing greenfoot.properties and using 3.6.0 version and the problem still presist. im gonna try upgrading my driver tomorrow.
How can i make a key press show an image and change back and other stuff
By AVH, with 4 replies.
Last reply by AVH, over 6 years ago:
Thanks got it working
How can i solve this lagging problem?
By KiddoNow, with 2 replies.
Last reply by KiddoNow, over 6 years ago:
danpost wrote...
Check your speed slider and make sure it is about in the middle of the bar. Make sure you are not using
Greenfoot.delay
unnecessarily. Check that you do not have an over-abundance of actors in your world. Those are usual reasons for lagging. Excessive image manipulation can also tax the CPU and cause lagging. If you feel none of these is the cause, you may need to show all your code (uploading the scenario with published source would be the easiest way to make the codes available to others).
Thank you so so so much! It was, indeed, because there were
Selecting only one spacecraft
By Finn.C, with 1 reply.
Replied to by danpost, over 6 years ago:
Finn.C wrote...
Hi! I was just trying to make an space invaider type of game and was wondering how I can only select one thing out of a bunch. For Example: I have 10 spacecrafts and only want one to shoot. Is there a way to do that? Thanks!
Random? From world? <Code Omitted>
How can I make a object change color when the mouse is on it?
By Finn.C, with 1 reply.
Replied to by danpost, over 6 years ago:
The condition on line 15 will be true-- that is, the mouse will not be detected as moving on this object unless the mouse is moved on this object. To clarify, t will not be detected as moving on this object if the the mouse is ON the object, but does NOT move. Only change back to normal image BOTH when mouse moves, AND NOT on this object: <Code Omitted>
How do I create a countdown timer for my game?
By KiddoNow, with 1 reply.
Replied to by danpost, over 6 years ago:
Please refer to my
Value Display Tutorial
scenario.
Please help me with my assignment
By addia, with 8 replies.
Last reply by danpost, over 6 years ago:
addia wrote...
<Code Omitted>
In the quoted code, you do not need the score until after line 8. Maybe you can work with the following:
Check something is disappear in world
By MianBao_Bread, with 2 replies.
Last reply by MianBao_Bread, over 6 years ago:
danpost wrote...
MianBao_Bread wrote...
I want make a game like pacman, now I want to end the game when all score disappear. This is my Code << Code Omitted >> It's not work, I want to know how to solve it. I am sorry that my English is not good.
The condition in line 1 will always be
false
. A
List
object is always returned by
getObjectsInRange
. You need to check the size of the list returned; or rather, check if it is an empty list
162
163
164
165
166
167
168
X