1 / 23

Publish Your Project

Publish Your Project. How can other people play your game? Even people who don't have the Java Development Kit (JDK) installed. You can export your project as a runnable JAR file or publish it on Greenfoot's web site. James Brucker. 3 Ways to Share Your Project. Be Famous !.

amalia
Download Presentation

Publish Your Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Publish Your Project How can other people play your game? Even people who don't have the Java Development Kit (JDK) installed. You can export your project as a runnable JAR file or publish it on Greenfoot's web site. James Brucker

  2. 3 Ways to Share Your Project Be Famous ! Greenfoot web site web page download publish source Web + Applet crabworld/ crabworld.html JAR File crabworld.jar Run on desktop Run in browser

  3. How to Share Choose Scenario > Share

  4. Create a runnable JAR file • This creates a Java Archive (JAR) file of your game. • Anyone can run it... requires only Java Runtime (JVM). • Do not need Greenfoot or JDK "Lock" means user cannot set speed and use "Act".

  5. Running a JAR file • Just double-click on icon (in Explorer). • Or, run from command prompt: cmd> java -jar crabgame.jar

  6. To Run a JAR file... • You only need the Java Runtime Environment! (JRE)

  7. Share with your Friends Your friends need the Java Runtime Environment (JRE) to run your scenario. Don't need Greenfoot. Friend must download& install JRE.

  8. Publish as a Web Page • Scenario > Share ... • Choose "Webpage" and enter a directory name. • Creates a web page (.html) and 2 JAR files. a new directory for export "Unlock" to let user can set speed and use "Act".

  9. View Your Web Page • Double-click on the HTML file to load it. • You can edit the HTML file, too.

  10. What an Applet Cannot Do Applet is a Java program that runs inside a web browser. To protect your computer, there are some things an Applet cannot do: • Read and write files on hard disk. • Send info over Internet to any host except the host where the Applet came from. • Cannot use GamePad (it uses a custom library).

  11. Avoid Fat Applets • If your Applet is too big, you may not be able to upload to Greenfoot. • Fat applets take a long time to start (slow download) -- user may leave. Fat Applets: • Bigger than 1 - 2 MB. • Has big audio (WAV or MP3) files. • Has big images.

  12. Make your App Lighter • Make the music optional. (if not found, don't crash) • Resample MP3 files at 64bps or 92bps, and lower quality. • Use MP3 instead of WAV files. • Make images smaller. For Applet, usually 600x800 is max.

  13. How to Publish on Greenfoot.org 1. Pause your game when the screen looks the way you want (only has effect for "Publish"). 2. Choose Scenario > Share

  14. Publish on Greenfoot 1. Create an account on Greenfoot.org. 2. Login (to verify password). 3. Create your profile with picture. Mention Kasetsart ! 4. (in Greenfoot) Publish your scenario. 5. Let us know! • we will "invite" you to join collection 6. Join the "Kasetsart Codecamp" collection.

  15. Create an Account Register at http://www.greenfoot.org/users/new A scenario on Greenfoot.org can only be updated by one username, so consider appointing someone to manage your application.

  16. Login and Profile • Login to verify password. • Create a profile. • Add a link to your homepage (any place).

  17. Publish Greenfoot Scenario • Scenario > Export... • Choose "Publish".

  18. Publish Details Choose a Title Keywords so people can find scenario Description of scenario (write in a text file first) Your web home or http://cpe.ku.ac.th

  19. After you Publish • Let us know about your scenario. • "Codecamp" will invite you to join the Collection. • Login to GreenfootGallery. • find your scenario. • "accept invitation". Click to accept invitation. Scroll down to see who has viewed your scenario.

  20. Please Give us the Project • Create a ZIP file of your complete project.

  21. How to Make Music Optional • You can design your scenario so it will work with or without the wonderful (but fat) background music. Step 1: create a GreenfootSound object and catch any exception. It throws IllegalArgumentException if the file cannot be loaded. class MyWorld extends World { static String MUSICFILE = "sounds/SoundOfMusic.mp3"; private GreenfootSound music = null; public MyWorld( ) { super( 500, 400, 1); try { music = new GreenfootSound( MUSICFILE ); } catch (IllegalArgumentException ex) { music = null; }

  22. How to Make Music Optional (2) Step 2: each time you start or stop the music, check whether the GreenfootSound object is null. /** start the music when scenario is (re)started */ public void started( ) { if ( music != null ) music.play( ); } /** stop the music when scenario is stopped or paused */ public void stopped( ) { if ( music != null ) music.stop( ); }

  23. How to Make Music Optional (3) If you have a lot of "if (music != null) ..." logic in your program, then write a separate Music class which encapsulates this behavior so your main code doesn't need to use "if (music!=null)". public class Music { private GreenfootSound music = null; public Music(String filename) { try { music = new GreenfootSound( filename ); } catch (IllegalArgumentException ex) { /* no music */ } } /** start the music, if possible */ public void play( ) { if ( music != null ) music.play( ); } public void stop( ) { ... // similar to "play"

More Related