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 to make a game end when an actor touches a color
By Nico_ti, with 12 replies.
Last reply by danpost, over 7 years ago:
You can use the line I gave above by replacing
trailColor
with
Color.RED
or
Color.BLUE
.
Mouse click only does action once
By tqqdqq, with 3 replies.
Last reply by tqqdqq, over 7 years ago:
Thank you so much! That fixed it. And wow, thank you for the statistics, I'd just set the value randomly while troubleshooting this so I most likely would've fixed it, but it's interesting to know the exact percentage nonetheless. For the record though, it does move and it also has the same percent chance of removing the "opponent" actor, so it's interesting to see which one "wins." Regardless, thank you for the help.
Need help making bubbles appear on diagonal line & move from top left corner to bottom right & the last bubble end at coordinates 900,600.
By Dexadashd, with 3 replies.
Last reply by danpost, over 7 years ago:
With a rotation of 33 degrees, moving at a rate of 4 pixels per act, an actor will take a direct route between the two corners. To place an actor randomly, but exactly on the diagonal, take any random value less than 300 and multiply it by 3 for the x and multiply it by 2 for the y, to be where to add the actor into the world. Keep in mind that the actor will never be at exactly (900, 600) as the lower right corner is at (899, 599).
Checking if something is in the way
By CodeTime, with 1 reply.
Replied to by danpost, over 7 years ago:
Possible things you could try are: (1) use a for loop to move the actor one square at a time toward its destination, checking for collision at each square; (2) add an object the stretches between the origin and destination squares, not including the two squares and ensure it has no intersecting objects; (3) represent the position of the board in an array and iterate between the two positions looking for a non-empty position; There are probably other ways as well, but one of these should work for you.
Having better collision detection
By Notted, with 5 replies.
Last reply by Notted, over 7 years ago:
Code for detection: <Code Omitted>
Give points when cursor clicks on object.
By rycode, with 11 replies.
Last reply by danpost, over 7 years ago:
rycode wrote...
So, I think the score might be working, but I need to show it on a counter.
Maybe you should take a look at my
Value Display Tutorial
scenario.
Question with code (keydown)
By CodeTime, with 2 replies.
Last reply by CodeTime, over 7 years ago:
danpost I am not sure why you have wait set to 2 after moving the actor, as setting it to zero would seem more appropriate.[/quote wrote...
This is late but thank you very much for the help. To answer your question, this is because soon after, I was planning for another function to run if wait was set to 2, but did not get to it as I had a problem with the part that I posted.
MOVE ACTOR DOWN CONTINOUSLY UNTIL IT HIT ANOTHER ACTOR THEN STOP
By gdrgnxxi, with 1 reply.
Replied to by danpost, over 7 years ago:
<Code Omitted>
Adding numbers to an arrays content
By n1ght5t41xX, with 2 replies.
Last reply by n1ght5t41xX, over 7 years ago:
danpost wrote...
If I understand correctly, at the end, the sum of all elements will be 100. Remove the '+1' from line 8 and use one of the following for line 9: <Code Omitted>
thank you. have a nice day
Please help with picking random set location
By N0way, with 6 replies.
Last reply by danpost, over 7 years ago:
Sorry. Line 8 should be: <Code Omitted>
How to randomly spawn a new item once
By fuongbregas, with 4 replies.
Last reply by danpost, over 7 years ago:
You just need to drop eggs at random times (not all the time).
How do you let an object follow another object?
By Mathiiii, with 2 replies.
Last reply by Mathiiii, over 7 years ago:
Thanks!
how do I put game completed screen after my car eat all the coins in circular track
By hd3377, with 3 replies.
Last reply by hd3377, over 7 years ago:
Super_Hippo it worked finally.Thanks a lot.
MAKE ACTORS MOVE IN THE ORDER I WANT
By gdrgnxxi, with 4 replies.
Last reply by danpost, over 7 years ago:
gdrgnxxi wrote...
all actors move at the same time.
Maybe you should have your world deal with the key presses and inform the "current" ingredient how to respond. This would most probably require that you have a list or array of the ingredients to iterate through as the key presses are detected.
Making a win or lose state.
By Notted, with 21 replies.
Last reply by danpost, over 7 years ago:
Notted wrote...
It works! So the problem was with the way it was spawning in?
Yes. You had the actor spawning in, but the field,
thePlayer
, was not being set to that actor. My first line applies the assignment and my second one adds that (same) actor into the world.
194
195
196
197
198
199
200
X