My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

A video game framework for rapid game prototyping. Partly modeled after Britt Hannah's article Object-Oriented Game Design. Slowly building toward a strong sprite sheet component and eventually a 2D tile engine component.

Check out the player class built with the framework:

public class Player extends GamePart {
	
	private static final int DRAW_DEPTH = 9;
	private static final float FRICTION = 0.98f;
	private static final int COLOR = Color.RED;
	public static int BIG_RADIUS = 70;
	public static int SMALL_RADIUS = 55;
	
	public Player(GamePart parent) {
		super(parent);
	}
	
	public void load() {
		
		addPart(new Friction(this,FRICTION));
		
		addPart(new IsTouched(this,false));
		addPart(new XVelocity(this,0));
		addPart(new YVelocity(this,0));
		addPart(new OldPosition(this));
		addPart(new CanMakeShadow(this,false));
		
		Circle c = new Circle();
		c.x = World.SCREEN_WIDTH/2;
		c.y = World.SCREEN_HEIGHT/4;
		c.radius = Player.SMALL_RADIUS;
		
		CircleProperty cp = new CircleProperty(this);
		cp.set(c);
		addPart(cp);
		
		addHandler(new UpdateHandler(this));
		
		addHandler(new WallCollideHandler(this));
		
		DrawHandler drawHandler = addHandler(new DrawHandler(this));
		
		addHandler(new TouchHandler(this));
		
		addPart(new ColorProperty(this,COLOR));
		
		addPart(new DrawDepth(this,DRAW_DEPTH));
		GamePart world = getWorld();
		world.getPart(DrawService.class).register(drawHandler);
		
	}
	
}
Powered by Google Project Hosting