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

2012/1/6

Long Load Times

Morran Morran

2012/1/6

#
When you play a scenario on the Greenfoot gallery, it seems to load everything up front. This can take a while. Is there a way to program into your code when certain things are loaded, and when to hold back until later? Can I load levels 1 & 2 when the game starts up, but leave the images and sounds to other levels until later?
Morran Morran

2012/1/12

#
Okay. Since nobody responded to my first question, I'll assume that there is no way to customize how your game loads on the Greenfoot website. But is there a way to customize how it loads when not online? Like, when it opens from a jar file or from the Greenfoot program itself?
davmac davmac

2012/1/12

#
Well, images (except for class images) and sounds aren't loaded until your program actually loads them. So, unless I'm not understanding correctly what you asked for, you get that behavior automatically. (It's different on the website because Java loads the entire jar file before the scenario runs).
Morran Morran

2012/1/12

#
Thanks. So online, smaller jar file = shorter load time. I am now curious about it offline. Is the "load as needed" thing unique to Greenfoot, or is it something that would be easy to implement if I were to make a game (without Greenfoot)?
davmac davmac

2012/1/12

#
It's easy enough to load content out of files on disk when you need to, particularly if you're just talking about images and sounds; but it really depends on exactly what you want to do. Most modern games load not just images/sounds but also level layout and perhaps even code, which starts to get more complicated. I think it's not worth worrying about unless/until you start writing a game where loading time is an issue.
Morran Morran

2012/1/13

#
Okay, thanks.
You need to login to post a reply.