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

Comments for Bounce time

Return to Bounce time

A new version of this scenario was uploaded on Sun Oct 07 21:54:14 UTC 2012 You are the blue ball. Shoot the Yellow balls to get points. Normal red balls are neutral and will knock you about, don't shoot them or you will lose points. Red flaming balls will give you more points, but they are dangerous, look out! Ghost balls can only knock you about Controls: Turn left - Left arrow Turn right - Right arrow Shoot - Space or Down arrow Pause - P
Game/maniacGame/maniac

2012/10/7

You can like bounce down again now -nic- because I re-uploaded the game so the scores on the scoreboard would be fair
-nic--nic-

2012/10/8

cool
A new version of this scenario was uploaded on Mon Oct 08 18:53:29 UTC 2012 SOUND! MUSIC! Warning:Very loud put your sound level down before pressing play! bugs:Balls might get stuck in walls and play an annoying loop of sound
-nic--nic-

2012/10/8

nice one
A new version of this scenario was uploaded on Mon Oct 08 20:17:11 UTC 2012 Fixed a bug
Game/maniacGame/maniac

2012/10/8

nic why dont you try to set a high score
A new version of this scenario was uploaded on Tue Oct 09 14:32:56 UTC 2012 Remove wall bounce sounds
A new version of this scenario was uploaded on Wed Oct 10 06:20:23 UTC 2012 Some balls have random sizes
tylerstylers

2012/10/16

they get stuck in the wall
tylerstylers

2012/10/16

score saving dont work :(
TomazVDSNTomazVDSN

2012/10/18

We need to fix 2 details: 1) My blue ball get stuck in the wall 2) Score seems to have a issue It is a great, fun game.. thank you !
Game/maniacGame/maniac

2012/10/18

Thanks the score does work you just have to die again to see it and I will soon have a way to fix the wall glitch
Game/maniacGame/maniac

2012/10/18

If you like this try out tanker
A new version of this scenario was uploaded on Fri Oct 19 17:54:01 UTC 2012 Fixed the bug where you glitch into the wall thanks to danpost
A new version of this scenario was uploaded on Fri Oct 19 17:54:52 UTC 2012 Attached source code
Game/maniacGame/maniac

2012/10/19

The wall glitch is fixed thanx to danpost
scarereeperscarereeper

2012/10/19

i had over 1000 put then i accedently push reset before the scoreboard went up
Game/maniacGame/maniac

2012/10/19

That's harsh, try to be careful next time ;)
Game/maniacGame/maniac

2012/10/19

I hope someone can beat me it's boring to be 1st
scarereeperscarereeper

2012/10/19

game maniac, do you mind if i copy your scoreboard because mine doesn't work
Game/maniacGame/maniac

2012/10/19

Ok
Game/maniacGame/maniac

2012/10/19

It might be easier to follow the instructions given by -nic- on this link http://www.greenfoot.org/topics/2130
Game/maniacGame/maniac

2012/10/19

If you like this bebsure to take a look at the other fun time collection games :)
Game/maniacGame/maniac

2012/10/19

If you like this be sure to take a look at the other fun time collection games :)
scarereeperscarereeper

2012/10/19

ok thanks
scarereeperscarereeper

2012/10/19

i have a question about the Score=SCORE; variable. it says i doont have that variable (Score) help
Game/maniacGame/maniac

2012/10/19

How are you keeping the score in your world
scarereeperscarereeper

2012/10/19

what do you mean in wich section
scarereeperscarereeper

2012/10/19

import greenfoot.*; // (CrabWorld, ScoreBoard) import java.awt.Color; import java.util.List; /** * An actor class that can display a scoreboard, using Greenfoot's * UserInfo class. * * You typically use this by including some code into the world for when your game ends: * * <pre> * addObject(new ScoreBoard(800, 600), getWidth() / 2, getHeight() / 2); * </pre> * * Where 800 by 600 should be replaced by the desired size of the score board. * * @author Neil Brown * @version 1.0 */ public class ScoreBoard extends Actor { // The vertical gap between user images in the scoreboard: private static final int GAP = 10; // The height of the "All Players"/"Near Me" text at the top: private static final int HEADER_TEXT_HEIGHT = 25; // The main text color: private static final Color MAIN_COLOR = new Color(0x60, 0x60, 0x60); // dark grey // The score color: private static final Color SCORE_COLOR = new Color(0xB0, 0x40, 0x40); // orange-y // The background colors: private static final Color BACKGROUND_COLOR = new Color(0xFF, 0xFF, 0xFF, 0xB0); private static final Color BACKGROUND_HIGHLIGHT_COLOR = new Color(180, 230, 255, 0xB0); /** * Constructor for objects of class ScoreBoard. * <p> * You can specify the width and height that the score board should be, but * a minimum width of 600 will be enforced. */ public ScoreBoard(int width, int height) { setImage(new GreenfootImage(Math.max(600, width), height)); drawScores(); } private void drawString(String text, int x, int y, Color color, int height) { getImage().drawImage(new GreenfootImage(text, height, color, new Color (0, true)), x, y); } private void drawScores() { // 50 pixels is the max height of the user image final int pixelsPerUser = 50 + 2*GAP; // Calculate how many users we have room for: final int numUsers = ((getImage().getHeight() - (HEADER_TEXT_HEIGHT + 10)) / pixelsPerUser); final int topSpace = getImage().getHeight() - (numUsers * pixelsPerUser) - GAP; getImage().setColor(BACKGROUND_COLOR); getImage().fill(); drawString("All Players", 100, topSpace - HEADER_TEXT_HEIGHT - 5, MAIN_COLOR, HEADER_TEXT_HEIGHT); drawString("Near You", 100 + getImage().getWidth() / 2, topSpace - HEADER_TEXT_HEIGHT - 5, MAIN_COLOR, HEADER_TEXT_HEIGHT); drawUserPanel(GAP, topSpace, (getImage().getWidth() / 2) - GAP, topSpace + numUsers * pixelsPerUser, UserInfo.getTop(numUsers)); drawUserPanel(GAP + getImage().getWidth() / 2, topSpace, getImage().getWidth() - GAP, topSpace + numUsers * pixelsPerUser, UserInfo.getNearby(numUsers)); } private void drawUserPanel(int left, int top, int right, int bottom, List users) { getImage().setColor(MAIN_COLOR); getImage().drawRect(left, top, right - left, bottom - top); if (users == null) return; UserInfo me = UserInfo.getMyInfo(); int y = top + GAP; for (Object obj : users) { UserInfo playerData = (UserInfo)obj; Color c; if (me != null && playerData.getUserName().equals(me.getUserName())) { // Highlight our row in a sky blue colour: c = BACKGROUND_HIGHLIGHT_COLOR; } else { c = BACKGROUND_COLOR; } getImage().setColor(c); getImage().fillRect(left + 5, y - GAP + 1, right - left - 10, 50 + 2*GAP - 1); int x = left + 10; drawString("#" + Integer.toString(playerData.getRank()), x, y+18, MAIN_COLOR, 14); x += 50; drawString(Integer.toString(playerData.getScore()), x, y+18, SCORE_COLOR, 14); x += 80; getImage().drawImage(playerData.getUserImage(), x, y); x += 55; drawString(playerData.getUserName(), x, y + 18, MAIN_COLOR, 14); y += 50 + 2*GAP; } } } heres my whole scoreboard
scarereeperscarereeper

2012/10/19

import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot) import java.awt.Color; import java.awt.Font; import java.util.Calendar; /** * The ScoreBoard is used to display results on the screen. It can display some * text and several numbers. * * @author M Kolling * @version 1.0 */ public class GameOver extends Actor { public static final float FONT_SIZE = 48.0f; public static final int WIDTH = 400; public static final int HEIGHT = 300; int SCORE=0; /** * Create a score board with dummy result for testing. */ public GameOver() { this(100); } /** * Create a score board for the final result. */ public GameOver(int score) { makeImage("Game Over", "Score: ", "Press enter", score); SCORE=score; } /** * Make the score board image. */ private void makeImage(String title, String prefix, String prefix2, int score) { GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT); image.setColor(new Color(255,255,255, 128)); image.fillRect(0, 0, WIDTH, HEIGHT); image.setColor(new Color(0, 0, 0, 128)); image.fillRect(5, 5, WIDTH-10, HEIGHT-10); Font font = image.getFont(); font = font.deriveFont(FONT_SIZE); image.setFont(font); image.setColor(Color.WHITE); image.drawString(title, 60, 100); image.drawString(prefix + score, 60, 200); image.drawString(prefix2, 60, 250); setImage(image); } public void act() { if(Greenfoot.isKeyDown("enter")){ Worldy worldy = (Worldy) getWorld(); worldy.scoreboard(SCORE); getWorld().removeObject(this); } if(Greenfoot.isKeyDown("e")){ Worldy worldy = (Worldy) getWorld(); worldy.scoreboard(SCORE); getWorld().removeObject(this); } } } the game over
scarereeperscarereeper

2012/10/19

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Crab extends Actor { private int points= 0; private Counter counter; public Crab(Counter pointCounter) { counter = pointCounter; //Saves the reference to Counter.class in the variable counter } /** * Act - do whatever the Crab wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(4); if (Greenfoot.isKeyDown("left")) { turn (-3); } if (Greenfoot.isKeyDown("right")) { turn(3); } {Actor worm; worm = getOneObjectAtOffset(0 ,0, worm.class); if (worm != null) { World world; world = getWorld(); world.removeObject(worm); if (getWorld().getObjects(worm.class).isEmpty()) { //levelup(); } counter.add(5); } } } public void gameOver() { CrabWorld crabworld = (CrabWorld) getWorld(); getWorld().addObject(new GameOver(points),450, 375); } } the crab
scarereeperscarereeper

2012/10/19

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class CrabWorld here. * * @author (your name) * @version (a version number or a date) */ public class CrabWorld extends World { /** * Constructor for objects of class CrabWorld. * */ public CrabWorld() { super(560, 560, 1); prepare(); } /** * Prepare the world for the start of the program. That is: create the initial * objects and add them to the world. */ private void prepare() { Counter counter = new Counter(); addObject(counter, 84, 44); worm worm = new worm(); addObject(worm, 166, 62); worm worm2 = new worm(); addObject(worm2, 363, 174); worm worm3 = new worm(); addObject(worm3, 409, 287); worm worm4 = new worm(); addObject(worm4, 131, 57); worm worm5 = new worm(); addObject(worm5, 104, 42); worm worm6 = new worm(); addObject(worm6, 81, 39); worm worm7 = new worm(); addObject(worm7, 59, 50); worm worm8 = new worm(); addObject(worm8, 26, 37); worm worm9 = new worm(); addObject(worm9, 421, 324); worm.setLocation(278, 397); worm4.setLocation(109, 432); worm5.setLocation(504, 80); worm7.setLocation(20, 238); worm8.setLocation(208, 264); worm6.setLocation(231, 64); worm9.setLocation(473, 453); lobster lobster = new lobster(); addObject(lobster, 433, 97); lobster.setLocation(81, 302); Crab crab = new Crab(counter); addObject(crab, 102, 310); crab.setLocation(515, 153); crab.setLocation(493, 305); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(84, 44); counter.setLocation(37, 7); counter.setLocation(42, 14); worm worm10 = new worm(); addObject(worm10, 70, 143); } public void scoreboard(int SCORE) { addObject(new ScoreBoard(600, 600), getWidth() / 2, getHeight() / 2); if (UserInfo.isStorageAvailable()) {//test to see if your data is avalable(logged in) UserInfo myInfo = UserInfo.getMyInfo();// set myInfo to UserInfo if (SCORE> myInfo.getScore()) //test to see if your score is better than your last { myInfo.setScore(SCORE);//set the score to your info myInfo.store();// store the info } } Score=SCORE; } } the crabworld
scarereeperscarereeper

2012/10/19

thats it
scarereeperscarereeper

2012/10/19

i made the crab and crabworld myself
scarereeperscarereeper

2012/10/19

*non-bragging tone*
Game/maniacGame/maniac

2012/10/19

How do you get points in the game you are making is what I meant
scarereeperscarereeper

2012/10/19

oh the counter
scarereeperscarereeper

2012/10/19

every time my crab eats a worm 5 points comes up
Game/maniacGame/maniac

2012/10/19

Never mind
scarereeperscarereeper

2012/10/19

should my variable be in the counter
Game/maniacGame/maniac

2012/10/19

Remove Score = SCORE; then in your method gameOver() add CrabWorld world = (CrabWorld) getWorld(); world.scoreboard(points);
Game/maniacGame/maniac

2012/10/20

!BEWARE OF THE FIREBALL! This comment is an AD
A new version of this scenario was uploaded on Mon Oct 22 14:20:41 UTC 2012 Score appears immediatly
h123nh123n

2012/11/3

I love it! it is so awesome when the ball bounces, it is like real life!
A new version of this scenario was uploaded on 2021-05-17 17:03:12 UTC Updated for latest version of Greenfoot