aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/AssetPaths.hx4
-rw-r--r--source/Main.hx13
-rw-r--r--source/PlayState.hx19
-rw-r--r--source/core/Entity.hx20
-rw-r--r--source/core/MenuState.hx52
-rw-r--r--source/core/entities/Player.hx20
-rw-r--r--source/core/entities/Sekeleton.hx20
-rw-r--r--source/core/enums/EnityTypes.hx8
-rw-r--r--source/levels/Level1.hx22
-rw-r--r--source/utils/Constants.hx7
-rw-r--r--source/utils/Debug.hx11
11 files changed, 196 insertions, 0 deletions
diff --git a/source/AssetPaths.hx b/source/AssetPaths.hx
new file mode 100644
index 0000000..db7ef44
--- /dev/null
+++ b/source/AssetPaths.hx
@@ -0,0 +1,4 @@
+package;
+
+@:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
+class AssetPaths {}
diff --git a/source/Main.hx b/source/Main.hx
new file mode 100644
index 0000000..efa0e2d
--- /dev/null
+++ b/source/Main.hx
@@ -0,0 +1,13 @@
+package;
+
+import flixel.FlxGame;
+import openfl.display.Sprite;
+
+class Main extends Sprite
+{
+ public function new()
+ {
+ super();
+ addChild(new FlxGame(0, 0, PlayState));
+ }
+}
diff --git a/source/PlayState.hx b/source/PlayState.hx
new file mode 100644
index 0000000..5cc2a8b
--- /dev/null
+++ b/source/PlayState.hx
@@ -0,0 +1,19 @@
+package;
+
+import core.MenuState;
+import flixel.FlxG;
+import flixel.FlxState;
+
+class PlayState extends FlxState
+{
+ override public function create()
+ {
+ super.create();
+ FlxG.switchState(new MenuState());
+ }
+
+ override public function update(dt:Float)
+ {
+ super.update(dt);
+ }
+}
diff --git a/source/core/Entity.hx b/source/core/Entity.hx
new file mode 100644
index 0000000..c956326
--- /dev/null
+++ b/source/core/Entity.hx
@@ -0,0 +1,20 @@
+package core;
+
+import core.enums.EnityTypes;
+import flixel.FlxSprite;
+
+class Entity extends FlxSprite
+{
+ public var entityType:EntityType;
+
+ public function new(x:Float, y:Float, _entityType:EntityType)
+ {
+ super(x, y);
+ this.entityType = _entityType;
+ }
+
+ override public function update(dt:Float)
+ {
+ super.update(dt);
+ }
+}
diff --git a/source/core/MenuState.hx b/source/core/MenuState.hx
new file mode 100644
index 0000000..e8b30bf
--- /dev/null
+++ b/source/core/MenuState.hx
@@ -0,0 +1,52 @@
+package core;
+
+import flixel.FlxG;
+import flixel.FlxState;
+import flixel.addons.display.FlxStarField.FlxStarField2D;
+import flixel.text.FlxText;
+import flixel.util.FlxColor;
+import levels.Level1;
+import utils.Constants;
+import utils.Debug;
+
+class MenuState extends FlxState
+{
+ override public function create()
+ {
+ Debug.log("Menu State");
+ var title1 = generateText("Your Enemy is in Another", 24, Constants.defaultFont);
+ var title2 = generateText("Dungeon", 30, Constants.stylyzedFont);
+ title2.y = title2.y + 25;
+ title2.color = FlxColor.RED;
+ title2.angle = -9.74;
+ var starfield:FlxStarField2D = new FlxStarField2D(0, 0, FlxG.width, FlxG.height, 500);
+ add(starfield);
+ add(title1);
+ add(title2);
+ if (FlxG.sound.music == null)
+ {
+ FlxG.sound.playMusic(AssetPaths.TitleMusic__ogg, 1, true);
+ }
+ super.create();
+ }
+
+ override public function update(dt:Float)
+ {
+ if (FlxG.keys.anyPressed([X]))
+ {
+ FlxG.sound.music.stop();
+ FlxG.switchState(new Level1());
+ }
+ super.update(dt);
+ }
+
+ private function generateText(text:String, size:Int, font:String)
+ {
+ var displayText:FlxText = new FlxText();
+ displayText.text = text;
+ displayText.size = size;
+ displayText.font = font;
+ displayText.screenCenter();
+ return displayText;
+ }
+}
diff --git a/source/core/entities/Player.hx b/source/core/entities/Player.hx
new file mode 100644
index 0000000..a66271c
--- /dev/null
+++ b/source/core/entities/Player.hx
@@ -0,0 +1,20 @@
+package core.entities;
+
+import core.enums.EnityTypes.EntityType;
+import flixel.util.FlxColor;
+import utils.Debug;
+
+class Player extends Entity
+{
+ public function new(x:Float, y:Float)
+ {
+ super(x, y, EntityType.PLAYER);
+ makeGraphic(16, 16, FlxColor.LIME);
+ Debug.log("Player Spawned");
+ }
+
+ override public function update(dt:Float)
+ {
+ super.update(dt);
+ }
+}
diff --git a/source/core/entities/Sekeleton.hx b/source/core/entities/Sekeleton.hx
new file mode 100644
index 0000000..b5039b2
--- /dev/null
+++ b/source/core/entities/Sekeleton.hx
@@ -0,0 +1,20 @@
+package core.entities;
+
+import core.enums.EnityTypes.EntityType;
+import flixel.util.FlxColor;
+import utils.Debug;
+
+class Skeleton extends Entity
+{
+ public function new(x:Float, y:Float)
+ {
+ super(x, y, EntityType.ENEMY);
+ makeGraphic(16, 16, FlxColor.RED);
+ Debug.log("Skeleton Spawned");
+ }
+
+ override public function update(dt:Float)
+ {
+ super.update(dt);
+ }
+}
diff --git a/source/core/enums/EnityTypes.hx b/source/core/enums/EnityTypes.hx
new file mode 100644
index 0000000..d6b308a
--- /dev/null
+++ b/source/core/enums/EnityTypes.hx
@@ -0,0 +1,8 @@
+package core.enums;
+
+enum EntityType
+{
+ PLAYER;
+ ENEMY;
+ NPC;
+}
diff --git a/source/levels/Level1.hx b/source/levels/Level1.hx
new file mode 100644
index 0000000..1bf927f
--- /dev/null
+++ b/source/levels/Level1.hx
@@ -0,0 +1,22 @@
+package levels;
+
+import core.entities.Player;
+import core.entities.Sekeleton.Skeleton;
+import flixel.FlxState;
+
+class Level1 extends FlxState
+{
+ override public function create()
+ {
+ super.create();
+ add(new Player(12, 12));
+ add(new Skeleton(0, 1));
+ add(new Skeleton(12, 32));
+ add(new Skeleton(56, 12));
+ }
+
+ override public function update(dt:Float)
+ {
+ super.update(dt);
+ }
+}
diff --git a/source/utils/Constants.hx b/source/utils/Constants.hx
new file mode 100644
index 0000000..c151e55
--- /dev/null
+++ b/source/utils/Constants.hx
@@ -0,0 +1,7 @@
+package utils;
+
+class Constants
+{
+ public static var defaultFont:String = AssetPaths.C800__ttf;
+ public static var stylyzedFont:String = AssetPaths.Lazer84__ttf;
+}
diff --git a/source/utils/Debug.hx b/source/utils/Debug.hx
new file mode 100644
index 0000000..6c0b831
--- /dev/null
+++ b/source/utils/Debug.hx
@@ -0,0 +1,11 @@
+package utils;
+
+import lime.utils.Log;
+
+class Debug
+{
+ public static function log(message:Any)
+ {
+ Log.println(message);
+ }
+}