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
add random obstacle
By Tezuka, with 10 replies.
Last reply by Tezuka, over 13 years ago:
ok thx now i got it
Screen Wraping
By bbwf, with 3 replies.
Last reply by bbwf, over 13 years ago:
Got it THANKS!
Lost on how to do a lab. Can anyone help?
By Nameisjonny, with no replies.
Goal: This is comprehensive lab that will require you to apply all the skills learned on the course (i) problem solving, (ii) prototype design, (iii) implementation using Greenfoot and Java and (iv) testing it to make sure it works as expected. Objective: To meet the goal stated above you design your own Greenfoot scenario for a given problem. Also make use of (i) method definition and call (ii) repetition control structure in for loop and while loop and selection control structure in if..else, (iii) definition of a user-defined World, (iv) definition of user-defined Actors and “act” method (understand the act method), and (v) adding objects and strings to the scenarios. We will also learn modular development using methods. We will also learn to use the animations methods we studied. The problem: You are required to create a scenario that plays the game Craps. (Don’t worry we will explain what Craps is.) Craps algorithm: Craps is a game played with a pair of six-faced dice. While there are many variations of the game, we will use a simplified version as explained below: 1. Initial round: a. A played rolls a pair of dice. b. Let the sum of the die1 value and die 2 value be called points. c. If the points is 7 or 11, the player wins and the game ends. d. If the points is 2,3 or 12, the player loses and the game ends. e. If the points is anything other than above go to step 2 for continuing to play, 2. Subsequent rounds: a. The player rolls the pair of dice again. b. Let the sum of the dice be called nextPoints. c. If the nextPoints is same as points scored in the initial round, then the player wins and the game ends. d. If the nextPoints is 7, the player loses and the game ends. e. If the nextPoints is anything other than the above two (c., d.) then the player continues to roll and rules of the subsequent rounds apply. What to do and How to do it? We will develop the solution for the problem in incremental steps. 1. Get a pair of dice and play the game as specified above. It helps to have a friend around so that you can discuss the game with him/her. Understand the various outcomes of dice rolls and the rules for each of these, Specifically make sure you understand what are conditions for terminating the game and the conditions for continuing the game, and also the conditions for a win or a loss. 2. In order to understand programming requirements, we will first develop a prototype to implement the algorithm given above. a. Define a CrapsWorld class as a subclass of World b. Define a Craps class as a subclass of Actor. c. Connect the two by instantiating Craps object inside the CrapsWorld. d. Inside Craps class develop the program for the algorithm given above in steps: code only the “Initial round” and test it. Then develop the code for “subsequent round”. Implement the code using meaningful methods. e. Test the complete program and make sure it works for all cases. 3. After you have completely tested the correctness of the logic, then take the components of the scenario and add animations. For example, the die can be animated. The roll can be animated. You can add other actors like people, trees and barrels (!) to the scenario and make them move around etc. The sky is the limit. Show your originality and creativity.
Variable does not update
By Barador, with 10 replies.
Last reply by -nic-, over 13 years ago:
its okay :)
HELP!
By USER67, with 5 replies.
Last reply by USER67, over 13 years ago:
Thanks a bunch!
question..
By ader108, with 3 replies.
Last reply by Gevater_Tod4711, over 13 years ago:
no static is not unchageable. thats final.
Greenfoot friends!
By jabirfatah91, with no replies.
How are you all? Any new news?
Hey
By BradH, with 9 replies.
Last reply by Spilli, over 13 years ago:
Ok ;)
Snake Movement
By ThanosDoulgeris, with 1 reply.
Replied to by Gevater_Tod4711, over 13 years ago:
There are many Snake projects on this page and also some of them are with-source. It would be the easyest way if your could just look at this scenarios and see how they've done this.
A simple question! Please answer.
By myheartwillgoon, with 1 reply.
Replied to by Gevater_Tod4711, over 13 years ago:
Set speed doesn't set the speed of only one class but of whole Greenfoot. so if you say Greenfoot.setSpeed(35); and then Greenfoot.setSpeed(15); Greenfoot will only use the second of this values. Also in the botom right of greenfoot there is a scrollbar to set Greenfoots speed.
problems to write the right code for a scenario
By Insomnia, with 4 replies.
Last reply by Insomnia, over 13 years ago:
Do you want to write the code for me? :D I am not able to do this :(
What do we mean by regular array?
By hkrhässleholm, with 9 replies.
Last reply by hkrhässleholm, over 13 years ago:
Thanks, i think i got My expected answer
The nullPointerException error...
By Stormtrooper299, with 10 replies.
Last reply by davmac, over 13 years ago:
<Code Omitted>
But does that still have the same problem?
Yes, because if Enemies.main is null the call to Enemies.main.getWorld() causes a NullPointerException. However, you can simply change the order: <Code Omitted> In this version, due to "lazy evaluation", if Enemies.main is null then Enemies.main.getWorld() will not be evaluated.
Avoid start screen
By Malmotri, with 4 replies.
Last reply by Malmotri, over 13 years ago:
Some other thing is wrong wrong now. This shows up java.lang.ArrayIndexOutOfBoundsException: 3 at Snake.act(Snake.java:34) at greenfoot.core.Simulation.actActor(Simulation.java:565) at greenfoot.core.Simulation.runOneLoop(Simulation.java:523) at greenfoot.core.Simulation.runContent(Simulation.java:213) at greenfoot.core.Simulation.run(Simulation.java:203) I uploaded this scenario so you you can see whats wrong. I would be very grateful. http://www.greenfoot.org/scenarios/6773 This is how i did it.
How can I create red brick square on greenfoot?
By Future, with 1 reply.
Replied to by danpost, over 13 years ago:
We could say that the code to get a square/rectangle is built into the GreenfootImage of the Actor. Each actor has an 'image' which IS a rectangular area. Within the bounds of this rectangle is where the image of the actor appears. You only need to create a GreenfootImage object of appropriate size and draw along each edge the image of the brick (just program it to draw one edge, then rotate the main image to continue drawing the brick image around all four edges).
917
918
919
920
921
922
923
X