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
Increasing the speed of enemies over time
By surgikar, with 6 replies.
Last reply by surgikar, over 9 years ago:
I just basically repeat the prepare code<Code Omitted>
Colission from the side/top
By Casper, with no replies.
I'm doing a mario game. I have classes Mario and Enemy. If Mario touches enemy from the top(jumps on it) the enemy should disappear but if the enemy touches Mario from the side, Mario should disappead. How can I detect if Mario is touching Enemy from the side or top?
Racing Off-Track
By DamonAG, with 4 replies.
Last reply by DamonAG, over 9 years ago:
Alright, it seems to be working, but the collision boxes on either the car or the mud is larger than it appears to be. Is there a way to tweak the entity so that if the visible section of the car is touching the visible section of the mud, then the care would reduce to half speed? I can almost guarantee this is my problem, seeing as I have collision for checkpoints and the car, and the act is called before the car is visibly touching the checkpoint.
getObjectsInRange is always empty?
By Robot_Face, with 3 replies.
Last reply by Robot_Face, over 9 years ago:
Actually, I figured it out. When I just create a Center in the GUI and press Run, it is not seen by the method getObjectsInRange. I have to either Save the World or manually create it in the world's prepare method. It's not the most convenient, but at least now I know it's not a problem with my code.
Counter which always goes up
By BrianOK, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
Have a variable: <Code Omitted>In the act method, increase it by 2: <Code Omitted>Now you have a counter which increases by 2 every act cycle (about 110 per second).
Goose game
By AURA, with no replies.
hi, i started to study Greenfoot, someone can send me the program to the Goose game i've a lot of problem for create boxes and the penitentiary. tnk
I need objects to spawn from one side of the screen
By BrianOK, with 5 replies.
Last reply by danpost, over 9 years ago:
You will probably set a minimum time between spawns (or you can use the location of the last spawned pipe to prevent another from being placed to quickly). I think I would prefer the prevention way -- then use a random chance to vary the gaps. Your world can keep a reference to the last pipe spawned: <Code Omitted>Then, in the act:
moving from level 1 to level 2
By ChrisD, with 1 reply.
Replied to by ChrisD, over 9 years ago:
i tried making altercations to the code so that everything that is happening in level 1 will happen in level 2 but instead there will be an error (e.g. instead of grabbing a crystal it will crash the game and say that it cannot be retrieved from level 1)
Uploading a new scenario instead of updating an old one
By Ruv25808, with 5 replies.
Last reply by Ruv25808, over 9 years ago:
Im not sure i understand you. Is there a different way i can name the scenario to make it say share instead of update?
move from level 2 to level 3
By ali18, with 2 replies.
Last reply by ali18, over 9 years ago:
Thank you for your help, its all working outstandingly.
Help aiming at a moving player
By jordanmyer, with 1 reply.
Replied to by danpost, over 9 years ago:
You are calling the 'getX' and 'getY' methods on a Class object, not on an object of the class. Player is the name of one of your classes, it does not refer to that which was created from the class, which is what has an x- and y-coordinate value in the world. You need to get the objects in the world of that class, if any, and then get the coordinates of it:
how do i make meteors fall randomly
By ChrisD, with 16 replies.
Last reply by danpost, over 9 years ago:
I will repeat one more time, more explicitly. The number of meteors dodged does not need to be tracked. For the first level, you will be spawning 20 meteors, controlled by the number spawned and the current maximum number to spawn. The 'meteorCount' field will count the number of spawned meteors this level and 'maxCount' is the maximum number of meteors to spawn this level (set to 20 for level 1), then (in world class act): <Code Omitted>says to spawn a meteor if the maximum has not been reached and any other conditions sa
Sound does not play
By 7oel, with 3 replies.
Last reply by 7oel, over 9 years ago:
danpost wrote...
I think you should simplify matters by ridding yourself of all the method calls. A simple class code might be something like this:
How to delay a new world
By 7oel, with 14 replies.
Last reply by 7oel, over 9 years ago:
danpost wrote...
Take the 'if' block out from where you put it, add the following into the class: <Code Omitted>and put the 'if 'block at line 3 of the act method supplied here.
thanks!
Timer and Powerup Question
By icantstudy995, with 6 replies.
Last reply by danpost, over 9 years ago:
icantstudy995 wrote...
Should I add slowDownTimer = 180 in line 6?
Yes, I forgot to mention how to start the timer.
when I add this piece of code, which is in the rocket class, my game over screen stops showing up when my rocket ship hits an asteroid.
Need to see the Rocket class codes -- not the world's.
359
360
361
362
363
364
365
X