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

Report as inappropriate.

Loopy
Loopy presents ...

2012/5/12

OrbWorld 2

No description.

3089 views / 20 in the last 7 days

Tags: with-source

open in greenfoot
Your browser does not support the canvas tag.
LoopyLoopy

2012/5/12

I have been able to get the orb to bounce off the floor and the right wall but not the roof and left wall, working on that. Will post update when I do.
LoopyLoopy

2012/5/12

Still stuck on the bouncing thing but here are two new things: 1. I added sound to play but keep getting an error screen even though it compiles. 2. When I try to populateWorld(); with Orbs it will not compile even though it is copied exactly from one of my earlier programs that did work substituting orb for worm. (won't compile with or without capital letter) Will keep working!
A new version of this scenario was uploaded on Sat May 12 21:19:49 UTC 2012
danpostdanpost

2012/5/13

You need to put the sound file in the 'sounds' folder within the scenarios folder. Make sure, when you add Orb objects into the world, that you use 'addObject(new Orb(int, int), int, int);', supplying both the x and y speeds and the x and y locations. For top and left bounce, you need to compare <= 0, not >= getWorld().getHeight() or >= getWorld().getWidth(). You will also need an offset value for the checks as the image of the object is smaller than the image itself (I thought 15 was about right). So the checks would be left: <= -15 right: >= getWorld().getWidth() + 15 top: <= -15 bottom: >= getWorld().getHeight() + 15 The only other thing I saw, was the need for an 'addedToWorld(World world)' method in the Orb class to initialize the exactX and exactY values to getX() and getY().
LoopyLoopy

2012/5/13

Thanx danpost. I figured out the sound thing last night. And "duh" on my part when it comes to the left wall and roof.
A new version of this scenario was uploaded on Sun May 13 13:39:29 UTC 2012 Finished

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.