Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
160 additions
and
8 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
package | ||
{ | ||
import org.flixel.FlxGame; | ||
import states.MenuState; | ||
//import states.MenuState; | ||
import states.PlayState; | ||
|
||
// Display properties | ||
[SWF(width = "720", height = "480", backgroundColor = "#000000")] | ||
// Prep preloader | ||
[Frame(factoryClass="Preloader")] | ||
|
||
/** | ||
* Ludum Dare 21 - | ||
* @author Paul S Burgess - | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class Main extends FlxGame | ||
{ | ||
public function Main() | ||
{ | ||
// Entry - invoke FlxGame constructor | ||
super(800, 600, MenuState, 1, 60, 30, true); | ||
super(180, 120, PlayState/*MenuState*/, 4, 60, 30, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package game | ||
{ | ||
import org.flixel.FlxSprite; | ||
|
||
/** | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class Player extends FlxSprite | ||
{ | ||
|
||
public function Player() | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,43 @@ | ||
package states | ||
{ | ||
import org.flixel.FlxG; | ||
import org.flixel.FlxState; | ||
import org.flixel.FlxText; | ||
|
||
/** | ||
* Ludum Dare 21 - | ||
* @author Paul S Burgess - | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class MenuState extends FlxState | ||
{ | ||
//[Embed(source = "../../data/font/Robotaur Condensed.ttf", fontFamily = "Robotaur", embedAsCFF = "false")] private var junk:String; | ||
|
||
public function MenuState() | ||
{ | ||
// Title text | ||
var tTxt:FlxText; | ||
tTxt = new FlxText(0, FlxG.height / 2 -12, FlxG.width, "ESCAPE"); | ||
tTxt.setFormat(null, 16, 0xffffffff, "center"); | ||
this.add(tTxt); | ||
|
||
// Instruction text | ||
tTxt = new FlxText(0, FlxG.height -12, FlxG.width, "Press SPACE to begin"); | ||
tTxt.setFormat(null, 8, 0xffffffff, "center"); | ||
this.add(tTxt); | ||
} | ||
|
||
override public function update():void | ||
{ | ||
if (FlxG.keys.justPressed("SPACE")) | ||
{ | ||
FlxG.fade(0xff000000, 0.5, onFade); | ||
} | ||
super.update(); | ||
} | ||
|
||
private function onFade():void | ||
{ | ||
FlxG.switchState( new PlayState() ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package states | ||
{ | ||
import org.flixel.FlxGroup; | ||
import org.flixel.FlxState; | ||
import world.Level; | ||
import world.LevelManager; | ||
|
||
/** | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class PlayState extends FlxState | ||
{ | ||
private var m_levelManager:LevelManager; | ||
private var m_currentLevel:Level; // Current room reference | ||
|
||
public static var s_layerBackground:FlxGroup; | ||
|
||
public function PlayState() | ||
{ | ||
m_levelManager = new LevelManager; | ||
m_currentLevel = m_levelManager.getCurrentRoom(); | ||
|
||
s_layerBackground = new FlxGroup; | ||
s_layerBackground.add(m_currentLevel); | ||
|
||
add(s_layerBackground); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package world | ||
{ | ||
import org.flixel.FlxG; | ||
import org.flixel.FlxGroup; | ||
import org.flixel.FlxSprite; | ||
//import org.flixel.FlxU; | ||
|
||
/** | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class Level extends FlxGroup | ||
{ | ||
[Embed(source = '../../data/textures/tile_floor.png')] private var imgTileFloor:Class; | ||
|
||
private const ROOM_TILE_SIZE:int = 9; | ||
private const ROOM_DRAW_X:int = FlxG.width / 2 - 9; | ||
private const ROOM_DRAW_Y:int = 12; | ||
|
||
public function Level() | ||
{ | ||
// Create level | ||
var r:Number = (Math.random() * 255.0); | ||
var g:Number = (Math.random() * 255.0); | ||
var b:Number = (Math.random() * 255.0); | ||
var roomColour:uint = 0xff000000 + (r << 16) + (g << 8) + b; | ||
|
||
var x:int = ROOM_DRAW_X, y:int = ROOM_DRAW_Y; | ||
for (var j:int = 0; j <= ROOM_TILE_SIZE; ++j) | ||
{ | ||
for (var i:int = 0; i < ROOM_TILE_SIZE; ++i) | ||
{ | ||
var tile:FlxSprite = new FlxSprite(x,y); | ||
tile.loadGraphic(imgTileFloor); | ||
tile.color = roomColour; | ||
add(tile); | ||
|
||
x += tile.width / 2; | ||
y += tile.height / 2; | ||
} | ||
|
||
x = ROOM_DRAW_X - j * tile.width / 2; | ||
y = ROOM_DRAW_Y + j * tile.height / 2; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package world | ||
{ | ||
import world.Level; | ||
|
||
/** | ||
* Ludum Dare 21 - Escape | ||
* @author Paul S Burgess - 20/8/2011 | ||
*/ | ||
public class LevelManager | ||
{ | ||
private var m_levels:Array; | ||
|
||
private var m_numRooms:int; | ||
private var m_currentRoom:int; | ||
|
||
public function LevelManager() | ||
{ | ||
m_levels = new Array; | ||
m_levels.push(new Level); | ||
m_numRooms = 1; | ||
|
||
m_currentRoom = 0; | ||
} | ||
|
||
public function getCurrentRoom():Level | ||
{ | ||
return m_levels[m_currentRoom]; | ||
} | ||
} | ||
} |