Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


Home > >

27. May 2013

 

In this day and age almost all graphics engines are behind the curtain based on 3D.  It's just the way graphics hardware works, so we now deal with textures instead of pixels  SpriteProjectand sprites.  At the end of the day, almost every single 3D game engine get a 2D sprite engine created on top off it, and now jMonkeyEngine is no exception with the release of The Sprite Project.

 

In case you have never heard of it, jMonkeyEngine is a complete Java based 3D engine, that is quite mature ( version 3+, over a decade old! ) and completely open source.  The Sprite Project is a 2D sprite engine built over top of it.  Here is a sample application taken from the documentation(pdf link).

 

package mygame;

import com.jme3.app.SimpleApplication;


public class Main extends SimpleApplication {

static Main app;

public static void main(String[] args) {
  app = new Main();
  app.start();
}

static SpriteEngine engine = new SpriteEngine();

@Override
public void simpleInitApp() {
  Sprite sprite = new Sprite(“Textures / Sprite.png”, “Sprite 1”, assetManager,
    true, true, 9, 1, 0.15f, “Loop”, “Start”);
  SpriteLibrary.l_guiNode = guiNode;
  SpriteLibrary library = new SpriteLibrary(“Library 1”, false);
  library.addSprite(sprite);
  engine.addLibrary(library);
}

@Override
public void simpleUpdate(float tpf) {
  engine.update(tpf);
  }
}

Pretty simple looking eh?

So if you are looking for a 2D sprite library built on top of a great Java 3D engine, you need look no further.

, ,

blog comments powered by Disqus

Month List

Popular Comments