Posts

/** * We must set the screen dimensions to something */ final int BLOCK = 16, screenWidth = 32*BLOCK, screenHeight = 27*BLOCK; /** * Gravity consists of a uniform downforce, * and a gravitational acceleration */ float DOWN_FORCE = 2; float ACCELERATION = 1.3; float DAMPENING = 0.75; /** * initializing means building an "empty" * level, which we'll */ void initialize() { frameRate(30); reset(); } /** * Reset the entire game */ void reset() { clearScreens(); addScreen("MainLevel", new MainLevel(4*width, height)); } /** * Our "empty" level is a single layer * level, doing absolutely nothing. */ class MainLevel extends Level { MainLevel(float levelWidth, float levelHeight) { super(levelWidth, levelHeight); addLevelLayer("background layer", new MainBackgroundLayer(this)); addLevelLayer("main layer", new MainLevelLayer(this)); setViewBox(0,0,screenWidth,screenHeight);