Appendix 3: Creating Applet for online distribution
To make your Env3D an Applet so that it can be viewed from a web browser. Follow these simple steps:
- Make sure that your game loop is inside the class called "Game".
- Make sure that your game loop is inside the method "play().
- Add the following import statement:
- Change your Game class decoration to look like the following:
public class Game extends EnvApplet
- Compile your program, make sure that there no errors.
- Right click on the "Game" class and select the "Run Env3D Applet" option at the bottom of the pop-up menu.
- After waiting for a bit, your browser would launch. Accepted all the security warnings, your program would start running inside the browser.
- (optional) To make your program available on the WWW, upload the "applet/" directory inside your BlueJ project to a public web server. The html file to launch your application is appletloader.html.
NOTE: You can also right-click on the Game class and select the "Upload to Env3D.org" option to upload your applet directly to Env3D.org. You can then share your game link with others.