diff options
Diffstat (limited to 'source/core')
-rw-r--r-- | source/core/Entity.hx | 20 | ||||
-rw-r--r-- | source/core/MenuState.hx | 52 | ||||
-rw-r--r-- | source/core/entities/Player.hx | 20 | ||||
-rw-r--r-- | source/core/entities/Sekeleton.hx | 20 | ||||
-rw-r--r-- | source/core/enums/EnityTypes.hx | 8 |
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; +} |