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
Move in the direction of a mouse click?
By solokeh, with 7 replies.
Last reply by danpost, over 12 years ago:
@Hawx_, the 'turnTowards' method is in the Actor API and needs an Actor object to run on. If this line of code is in the Ball class 'act' method (or a method that the 'act' method calls), just use: <Code Omitted>
Constructor Errors
By Gingervitis, with 15 replies.
Last reply by Gingervitis, over 12 years ago:
Ok. Thank you. It worked.
How do you make obstacles?
By LonelyCreeper, with 11 replies.
Last reply by LonelyCreeper, over 12 years ago:
so do i just put the code in the move() method?
timer
By milanapa, with 6 replies.
Last reply by danpost, over 12 years ago:
@milanapa, it would make sense to put the code in the class that creates the object that you are timing (if you are timing how long a world is active, put it in the class of that world; if you are timing how long an actor is 'alive', put it in the class of that actor). That way, as you add additional code, there will be less chance of having to modify this part.
2D sidescroll help
By Sergio, with 9 replies.
Last reply by danpost, over 12 years ago:
danpost wrote...
Then relocate and scroll after setScrollingBackground and before adding the other objects.
The key word was
after
.
Hockey Game Boundary Collision Problems
By camsterb, with 1 reply.
Replied to by camsterb, over 12 years ago:
New link to view scenario: http://www.greenfoot.org/scenarios/7184
Changing the background (world)
By bbwf, with 3 replies.
Last reply by danpost, over 12 years ago:
Yeah, I just copied the 'if' command from what was given and did not evaluate it. I was concerned mostly with getting the new world underway.
enemy?
By theuberjew, with 1 reply.
Replied to by Gevater_Tod4711, over 12 years ago:
If you just want an enemy you should look at a little-crab game. This ones are the simpelst scenarios. If you download a scenario you can look at the source.
Probably Small Conway's Game of Life Problem...
By camsterb, with 8 replies.
Last reply by danpost, over 12 years ago:
From any cell, there are eight possible neighbours, they occur at offsets of <Code Omitted>The x-offsets range from negative one to one; as do the y-offsets. The hole in the center is the current cell which is not a neighbour of itself. The first 'for' loop creates the values of the x-offsets and the second does the same for the y-offsets. The first 'if' eliminates self-neighbouring. The second one eliminates non-existent cells outside the world bounds. The last one checks the status of t
turnTowards problem
By DaBist, with 5 replies.
Last reply by DaBist, over 12 years ago:
Duta wrote...
I assume what you mean is that you want to be able to do <Code Omitted>but not have the rotation change. One way to do this is to store what the rotation was before turnTowards, and then set it back to the original rotation after it's done. What I'm trying to say is: <Code Omitted>
thanks, it works now :)
Make actors appear
By Peach, with no replies.
Hi, is it possible to do this: When the Crab eats 10 green worms (the score=10) , then the red worms will start to appear. What would the code be? I've got the first line: if (counter.getValue() == 10) {
Newish Greenfooter HELP! :) - Turning String name into Greenfoot Image
By TehDoctor, with 13 replies.
Last reply by TehDoctor, over 12 years ago:
That would work, but I want to make it even simpler because all 24 letters build off the 3 base letters. So although B is that strange half circle with a line, an M would be the same letter with just a line sticking out of it. So i just created the 3 base letters and a line. Then ill attach them together to make characters in the code. I may just set up 24 separate if statements for each letter. Unless there's some possible way to perform the toString() method backwards :D
Hockey Game Boundary Collision Problems
By camsterb, with no replies.
Hi. I'm looking for a formula to use to change the trajectory of a hockey player bouncing and sliding around a rectangle through use of the inbuild move method. <Code Omitted> This method seems to work perfectly, but sometimes the player manages to get stuck beyond the boundaries. The object rotates left and right with keypresses. It moves in the direction in is facing. Maybe it's to do with turning the object while bouncing off a wall? Anyway, here is the link to observe what I mean: http://www.greenfoot.org/scenarios/7181 I'm looking for criticism of my method and advice to solve my problem of moving beyond boundaries. Thanks As an additional question: I want to be able to shoot the puck and give it the current rotation of the hockey player. This allows the puck to move that direction. I have some code already for this, but there are glitches. I will post more details at request. All the code is visible in the link.
Compile error?
By erdelf, with 4 replies.
Last reply by erdelf, over 12 years ago:
oh damn, I know what the problem is, I forgot for a moment that the string class is an actual class and wrote a new class called String, sry for bothering you
actor not in world
By KierTulp, with 1 reply.
Replied to by KierTulp, over 12 years ago:
I just fixed the magnet one, it was because I had the getX() and getY() thingies in there.
897
898
899
900
901
902
903
X