Xholon Bestiary running as a PulpCore Applet

This page demonstrates that Xholon apps can be run as Java applets, by embedding them within PulpCore. PulpCore is an open source 2D rendering and animation framework.

This is the Xholon Bestiary app with its collaborative capabilities available through JavaScript and through the BeanShell Java interpreter. Beasts (cats and humans) move around and exchange greetings. Cats change from white to gray as they mature. Humans are tan colored. You can dynamically add any other type of beast and beast behavior while the app is running. Licorice, the green-eyed black cat, is light green. To observe the exchange of greetings, you should enable the Java Console.

Use this applet to help you learn Java.

The applet may take longer than a few seconds to load the first time.



Zombie.js  Dog.js  Termite.js  Dog.bsh  Termite.bsh  Zombie.bsh 

/* Copyright (C) 2010 Ken Webb, GNU Lesser General Public License */
import java.awt.Color;

import pulpcore.Stage;
import pulpcore.image.CoreFont;
import pulpcore.scene.Scene2D;
import pulpcore.sprite.FilledSprite;
import pulpcore.sprite.Group;
import pulpcore.sprite.Label;
import static pulpcore.image.Colors.*;

 * Title scene in the PulpCore version of the Bestiary.
 * @author <a href="">Ken Webb</a>
 * @see <a href="">Xholon Project website</a>
 * @since 0.8.1 (Created on July 25, 2010)
public class TitleScene extends Scene2D {
  // color of the habitat background
  private static final int COLOR_HABITAT = new Color(0x007B00).getRGB(); // HTML ForestGreen (deep)
  Label titleLabel = null;
  Label bestiaryButton = null; // TODO should be a Button
  Label optionsButton = null; // TODO should be a Button
  Group form = null;

  public void load() {
    int horCenter = Stage.getWidth() / 2;
    CoreFont font = CoreFont.getSystemFont().tint(GREEN);
    CoreFont headerFont = CoreFont.getSystemFont().tint(ORANGE);
    titleLabel = new Label(headerFont, "Bestiary", horCenter, 50, 200, 40);
    titleLabel.setAnchor(0.5, 0.5);
    bestiaryButton = new Label(font, "Start app", horCenter, 200, 120, 20);
    bestiaryButton.setAnchor(0.5, 0.5);
    optionsButton = new Label(font, "Options", horCenter, 250, 100, 20);
    optionsButton.setAnchor(0.5, 0.5);
    // Add the form fields to a group
    form = new Group(0, 0, Stage.getWidth(), Stage.getHeight());
    form.setAnchor(0.0, 0.0);
    // Add background and form to the scene
    add(new FilledSprite(COLOR_HABITAT));

  public void update(int elapsedTime) {
    if (bestiaryButton.isMouseReleased()) {
      // go to main app scene
      Stage.setScene(new BestiaryScene());
    else if (optionsButton.isMouseReleased()) {
      // go to options scene
      Stage.pushScene(new OptionsScene());