This site requires JavaScript, please enable it in your browser!
Greenfoot back

danpost's Comments

Back to danpost's profile

@vtn2@calvin.edu, the source for this scenario was not published; so, you cannot download the project to view the code.
@docinkc, start a new discussion thread and using the 'code' tag below the input box to insert the problem code. Include a brief explanation of the problem.
What is the high score to beat (see instructions)? I made a score of over 10,000 m.
Basically, you would just put the animation code for each within the 'addedToWorld' method of each class.
@Watchb, absolutely.
@Peach, if the world was wide enough to hold them, it would be 24+38*i, 510. The world width would have to be about 1000.
@Peach, obviously it is a call to 'addObject', a method in the World class that uses the signature 'addObject(actor, int, int)'. The actor is a new Letter object that is being placed within the array of letters declared near the top of the class. This line is found within a 'for' loop that iterates 'i' through the numbers 0 to 25 (for each letter of the alphabet). Notice in the scenario how I split the 26 letters into two rows of 13 letters each. The first int (the x-coordinate of where to place the letter actor) is '24+38*(i%13)'. This says to start at x-coordinate 24 and add 'i' factors of 38 (the distance between each letter). Taking the modulus 13 of 'i' starts the factor back at zero again for the second row. The second int (the y-coordinate of where to place the letter actor) is '510+30*(i/13)'. This says to start at y-coordinate 510 and add a factor of 30 for the second row ('i/13' will return 0 until 'i' reaches 13; then it will return one for the rest of the loop).
@Watchb, the 'getGenericActor' method is within the Hangman class.
@Watchb, just run the scenario and click on the buttons near the top-right of the window to look at the classes.