![greenfoot scoreboard greenfoot scoreboard](https://i.ytimg.com/vi/WIifij-961o/maxresdefault.jpg)
If (Greenfoot.mouseClicked(null) || Greenfoot. GetImage().scale((int)Math.round(getImage().getWidth() * 0.9), (int)Math.round(getImage().getHeight() * 0.9)) TitleSound = new GreenfootSound("title-theme.mp3") If (this.getClass().getName().equalsIgnoreCase("MenuScreen")) Score_tText("Score: " +totalFishEat) įish1 = getOneObjectAtOffset(4, 4, fish1.class) įish3 = getOneObjectAtOffset(4, 4, fish3.class) GetWorld().addObject(score_field, 90, 30) GetWorld().addObject(alert_win, 370, 300) įish = getOneObjectAtOffset(4, 4, fish.class) GetWorld().addObject(alert_loose, 370, 300) This is all I have for my Scoreboard world right now.Score score_field = new Score("Score:" + totalFishEat) ShowText("Total - " + (timeBonus + score) + "points", 550, 210) ShowText("Time bonus - " + timeBonus + "points", 550, 190) ShowText("Your final score: " + score + "points", 550, 170) * The LoseMessage displays and the game stops. * If the Enemy eats Peli before Peli eats all the fish, * the EndMessage is displayed and the game stops. * If the time reaches 0 before all the fish are eaten, * Decreases the time from the starting 500. If(getObjects(Fish01.class).isEmpty() & getObjects(Fish02.class).isEmpty() & getObjects(Fish03.class).isEmpty() & getObjects(Boss.class).isEmpty()) * Once all the fish are gone, game stops and the WinMessage Y = Greenfoot.getRandomNumber(getHeight()) * Adds an enemy and makes sure that it will not land onįor(int i=0 i 450 & x 200 & y 450 & x 200 & y < 400) Scores = 100 // gives you 100 points for each boss you killĪddObject(new Hook(this), Greenfoot.getRandomNumber(1100), 0) You can then dynamically (that is: while your program is. This allows you to have multiple World subclasses (in my example called Level1 and Level2). Scores = 15 // gives you 15 points for every fish03 eaten The Greenfoot class now has a method with the following signature: setWorld (World world) This method takes a world object as a parameter, and it will show that world in the Greenfoot main window. Scores = 10 // gives you 10 points for every fish02 eaten Scores = 5 //gives you 5 points for every fish01 eaten RandomFish03(c) //adds a random number of fish03 to random locations RandomFish02(b) //adds a random number of fish02 to random locations RandomFish01(a) //adds a random number of fish01 to random locations Time = 500 // time starts at 500 and goes downĪddObject (peli, 550, 300) //adds 1 pelican at the given x,y corridinates Score = 0 //score starts at 0 and goes up according to the type of fish eaten * Constructor for objects of class CrazyWorld. Showing your World subclass would go a long way to getting a decent answer to whether the scoreboard should be a World or Actor object. Another thing that must be presumed is that the addScore method adds to the list of high scores and not to the current game score.
![greenfoot scoreboard greenfoot scoreboard](http://users.csc.calpoly.edu/~mhaungs/projects/AvoiderGame/images/scoreBoardCode.png)
One thing that is left up in the air is whether each level runs in the same World object or in different World objects of the same type.
![greenfoot scoreboard greenfoot scoreboard](http://frccompsci.weebly.com/uploads/6/0/1/9/60195103/published/pengu.gif)
The addScore method cannot be in the World class, so I must presume you only have one subclass of World that all levels run in.
Greenfoot scoreboard code#
I currently have my addScore method in my World and there are multiple levels to the game.It took me a second to understand the phrase "with 3 letters that the user inputs", but I finally got it. The World class will simply serve as the background for your game though we will later add some code to create a scoreboard. That being said, I am unsure as to whether the easiest way being to make the scoreboard in the actor class or the world class. Green_for_Fun wrote.I am trying to figure out the easiest way to make a scoreboard that displays the top 10 highest scores with 3 letters that the user inputs.