There's not really a "nice" way of doing it at the moment. When the new sound stuff is released for Greenfoot there should be some much better methods that enable this and a lot more, but for now you're stuck with one of 3 bodgy solutions:
- Use something like JLayer separately from Greenfoot and implement it yourself. Potentially it's the "nicest" solution, but will take the most work by far.
- Use a huge wav file like you've already done - easy but as you've found completely impractical!
- Manually store somewhere in your code how long the wav file is, and use some form of timer system (based around real time using System.currentTimeMillis.) If you reset this timer each time the file starts you should be able to work out when the sound will have finished and therefore when to replay it.
Personally I'd lean towards using the last option of those three.
Nice start - you might want to up the speed slider a little and then have your objects move in smaller steps. At the moment it feels a bit jerky.
As for a next step on the game front, what about some form of scoring system?
You could load the pacman image as a separate file, which would enable you to use any shape you want ;-)
If you really want to use a drawArc method though, you can get the BufferedImage that backs the GreenfootImage you need and then draw on that using a Graphics2D object (which does have a drawArc method inherited from Graphics.)
It doesn't seem to work for me, I'm getting this error:
java.lang.IllegalArgumentException: java.io.FileNotFoundException: Could not find file: Gems\yellow.gif
at greenfoot.GreenfootImage.loadFile(GreenfootImage.java:202)
at greenfoot.GreenfootImage.<init>(GreenfootImage.java:100)
at greenfoot.Actor.setImage(Actor.java:296)
at Diamond.<init>(Diamond.java:53)
at PlatformWorld.buildLevel(PlatformWorld.java:181)
at Screens.background(Screens.java:75)
at Screens.act(Screens.java:55)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:346)
at greenfoot.core.Simulation.run(Simulation.java:178)
If you haven't already, make sure you put all your images inside the images folder. I'd hazard a guess that your gems folder isn't in your images folder at the moment which is what may be causing the issue.
Not a bad start! I'd personally disable up and down movement (makes it look a bit odd when he's just floating.) It'd also be cool if he went back to the same pose when he stopped? Sometimes he has his legs crossed which looks a bit strange!
Oh, and there's the small issue that before you hit the run button his legs are rather detached ;-)
One minor point - in the last level some of the translucent blocks can be quite difficult to make out against the background, perhaps colouring them slightly differently might help? Also, instead of the daffodils becoming clearer it'd be quite cool if there was a significant visual change :-)
2009/12/27
PushGame
2009/12/25
3-D Space Flight
2009/12/17
Maze Beta
2009/12/17
shooter
2009/12/17
PacMan
2009/12/17
platform_game
2009/12/17
Dude Walking
2009/12/1
Water Works
2009/11/28
Carbon Patrol