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
I need help creating a end game screen
By Mutiplyyou, with no replies.
i need help getting my endgame screen and it's saying "cannot find symbol- variable getwidth" i heres my world code and i have a class for the image and i get the game to stop already... <Code Omitted>
Can anyone give me a quick random spawing code?
By tomw, with 5 replies.
Last reply by danpost, almost 13 years ago:
If you are coding this in an Actor subclass, you cannot directly use 'getWidth' (or 'getHeight'). You need to execute those methods on a World object. The Actor class API has a method that returns the world it is in. To elaborate, all non-static methods are executed on an object. If the object is not explicitly given, it is executed on the object that the 'this' keyword would refer to. In a World subclass, 'this' refers to a specific world of that class the method resides in; in anActor subclass, 'this' refers to a specific actor of that class the method resides in.
beginner help
By csr1010, with 17 replies.
Last reply by csr1010, almost 13 years ago:
Scoreboard numbers
By Winkan, with 5 replies.
Last reply by Winkan, almost 13 years ago:
thanks will try it out! :)
Actor Following An Elliptical Line - Assistance Needed
By Telatsu, with 3 replies.
Last reply by danpost, almost 13 years ago:
I was able to create a scenario where the car would follow the line with the proper rotation all the way around the track. The movement of the car was done as follows: (1) while rotation is not a multiple of 90, turn clockwise (2) turn left 90 degrees and move forward one (3) while the color of the background is not yellow, turn right 90 degrees and move forward one (4) determine the new rotation of car by its location I will add another world and car to the scenario to use the method I first gave above and a button to go back and forth between the worlds; then, if you wish, I could uplo
How to put all actors in a world in an array orded based on position?
By Entity1037, with 2 replies.
Last reply by Entity1037, almost 13 years ago:
I need the player to be able to appear in front of or behind the isometric blocks based on if he's above/below/to the left of/to the right of them so the perspective doesn't get thrown off and the player doesn't appear, for example, behind the top of the block he should be standing on.
Help with my game....
By virginia001, with 3 replies.
Last reply by danpost, almost 13 years ago:
Basically, you want to hold the change in location in local fields (so you can negate the move if necessary), make the move, check for intersections, and move back if intersector(s) are present. As an alternative, you could save the location of the actor, move, and reset to saved location if intersector(s) present.
Increasing another class' interger in another class
By JasonZhu, with 16 replies.
Last reply by danpost, almost 13 years ago:
JasonZhu wrote...
I have trouble with the Rocket portion of the code
Without more to go on, it would be difficult to help you.
Small Problem
By csr1010, with 2 replies.
Last reply by GreenHouse, almost 13 years ago:
<Code Omitted> is useless; because 'this' can not be null. You want to check whether the object still exists in the world, right? So use instead: <Code Omitted>
Error message keeps coming up
By Affan, with 2 replies.
Last reply by Affan, almost 13 years ago:
Gevater_Tod4711 wrote...
When your object touches the worlds edge it get's removed. After that you execute the can see method. To execute this method your object needs to be in the world to check whether your object is touching the asteroid. So you get the error message. You could try adding a return statement after line 5 or just check whether the object is still in the world (if (getWorld() != null) before executing the canSee method.
Thanks for that. It solved my problem, clear explaination. If there was some kind of karma system I would give you some.
How to make a class the criteria for a method?
By Affan, with 1 reply.
Replied to by bourne, almost 13 years ago:
First, getObjects returns a List which cannot be assigned to the variable actor of type Actor. Second, are you wanting something like this? : <Code Omitted>
getOneObjectAtOffset not working?
By VincentG, with 3 replies.
Last reply by VincentG, almost 13 years ago:
I figured out what was happening, I miss understood getOneObjectAtOffset method. Thanks for the reply too :)
Steady image
By Chaveron, with 15 replies.
Last reply by Chaveron, almost 13 years ago:
Yea sorry, I forgot that part. public void setLocation(int x, int y) { int width = getWorld().getWidth(); int height = getWorld().getHeight(); while (x >= width) { x -= width; } while (x < 0) { x += width; } while (y >= height) { y -= height; } while (y < 0) { y += height; } super.setLocation(x, y); } But I found my problem already. I just
change the order of acting objects
By Jtlie, with 1 reply.
Replied to by danpost, almost 13 years ago:
You would have to link the pairs so that one 'knows' about the other. By their x locations and the direction of user input, you can determine which to move first. Move both at the same time (do not have both moved individually by their own act method calls).
zombie game
By jubyfollower, with no replies.
so ive plugged in a health for my player and i seems to work decently but when the zombie hits the player the health does not seem to go down? any ideas
757
758
759
760
761
762
763
X