aboutsummaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
authorIndrajith K L2022-03-22 02:20:02 +0530
committerIndrajith K L2022-03-22 02:20:02 +0530
commitf5e60ac6142f5f3d71f5a6edc581094df840f12e (patch)
tree68b7071b9862082ce3d0943b8b1f76744e411642 /source/core
downloadYEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.tar.gz
YEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.tar.bz2
YEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.zip
Initial Commit
* Basic Entity System Implemented
Diffstat (limited to 'source/core')
-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
5 files changed, 120 insertions, 0 deletions
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;
+}