From f5e60ac6142f5f3d71f5a6edc581094df840f12e Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 22 Mar 2022 02:20:02 +0530 Subject: Initial Commit * Basic Entity System Implemented --- .gitignore | 46 ++++++++++++++++++++ .vscode/extensions.json | 6 +++ .vscode/launch.json | 21 ++++++++++ .vscode/settings.json | 13 ++++++ .vscode/tasks.json | 13 ++++++ Project.xml | 84 +++++++++++++++++++++++++++++++++++++ assets/data/fonts/C800.ttf | Bin 0 -> 10004 bytes assets/data/fonts/Lazer84.ttf | Bin 0 -> 36776 bytes assets/data/fonts/minecraftia.ttf | Bin 0 -> 70324 bytes assets/images/aswani.png | Bin 0 -> 2793 bytes assets/images/enemy.png | Bin 0 -> 3567 bytes assets/images/heart.png | Bin 0 -> 143 bytes assets/images/icon.png | Bin 0 -> 513 bytes assets/images/images-go-here.txt | 0 assets/images/player_shadow.png | Bin 0 -> 145 bytes assets/images/tileset.png | Bin 0 -> 3108 bytes assets/music/TitleMusic.ogg | Bin 0 -> 406476 bytes assets/music/music-goes-here.txt | 0 assets/sounds/atmosphere1.ogg | Bin 0 -> 92227 bytes assets/sounds/cicada1.ogg | Bin 0 -> 23243 bytes assets/sounds/gotsomething.mp3 | Bin 0 -> 41834 bytes assets/sounds/heart.wav | Bin 0 -> 31062 bytes assets/sounds/heartbeat_fast_0.wav | Bin 0 -> 397080 bytes assets/sounds/hits/1.ogg | Bin 0 -> 6376 bytes assets/sounds/hits/10.ogg | Bin 0 -> 6698 bytes assets/sounds/hits/11.ogg | Bin 0 -> 6779 bytes assets/sounds/hits/12.ogg | Bin 0 -> 6265 bytes assets/sounds/hits/13.ogg | Bin 0 -> 6756 bytes assets/sounds/hits/14.ogg | Bin 0 -> 6922 bytes assets/sounds/hits/15.ogg | Bin 0 -> 6341 bytes assets/sounds/hits/16.ogg | Bin 0 -> 7089 bytes assets/sounds/hits/17.ogg | Bin 0 -> 6120 bytes assets/sounds/hits/18.ogg | Bin 0 -> 7203 bytes assets/sounds/hits/2.ogg | Bin 0 -> 6179 bytes assets/sounds/hits/3.ogg | Bin 0 -> 6655 bytes assets/sounds/hits/4.ogg | Bin 0 -> 6573 bytes assets/sounds/hits/5.ogg | Bin 0 -> 6654 bytes assets/sounds/hits/6.ogg | Bin 0 -> 6369 bytes assets/sounds/hits/7.ogg | Bin 0 -> 6716 bytes assets/sounds/hits/8.ogg | Bin 0 -> 6772 bytes assets/sounds/hits/9.ogg | Bin 0 -> 6281 bytes assets/sounds/hits/README.txt | 4 ++ assets/sounds/monster_growl.wav | Bin 0 -> 448152 bytes assets/sounds/thunder.ogg | Bin 0 -> 51493 bytes hxformat.json | 15 +++++++ source/AssetPaths.hx | 4 ++ source/Main.hx | 13 ++++++ source/PlayState.hx | 19 +++++++++ source/core/Entity.hx | 20 +++++++++ source/core/MenuState.hx | 52 +++++++++++++++++++++++ source/core/entities/Player.hx | 20 +++++++++ source/core/entities/Sekeleton.hx | 20 +++++++++ source/core/enums/EnityTypes.hx | 8 ++++ source/levels/Level1.hx | 22 ++++++++++ source/utils/Constants.hx | 7 ++++ source/utils/Debug.hx | 11 +++++ 56 files changed, 398 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 Project.xml create mode 100644 assets/data/fonts/C800.ttf create mode 100644 assets/data/fonts/Lazer84.ttf create mode 100644 assets/data/fonts/minecraftia.ttf create mode 100644 assets/images/aswani.png create mode 100644 assets/images/enemy.png create mode 100644 assets/images/heart.png create mode 100644 assets/images/icon.png create mode 100644 assets/images/images-go-here.txt create mode 100644 assets/images/player_shadow.png create mode 100644 assets/images/tileset.png create mode 100644 assets/music/TitleMusic.ogg create mode 100644 assets/music/music-goes-here.txt create mode 100644 assets/sounds/atmosphere1.ogg create mode 100644 assets/sounds/cicada1.ogg create mode 100644 assets/sounds/gotsomething.mp3 create mode 100644 assets/sounds/heart.wav create mode 100644 assets/sounds/heartbeat_fast_0.wav create mode 100644 assets/sounds/hits/1.ogg create mode 100644 assets/sounds/hits/10.ogg create mode 100644 assets/sounds/hits/11.ogg create mode 100644 assets/sounds/hits/12.ogg create mode 100644 assets/sounds/hits/13.ogg create mode 100644 assets/sounds/hits/14.ogg create mode 100644 assets/sounds/hits/15.ogg create mode 100644 assets/sounds/hits/16.ogg create mode 100644 assets/sounds/hits/17.ogg create mode 100644 assets/sounds/hits/18.ogg create mode 100644 assets/sounds/hits/2.ogg create mode 100644 assets/sounds/hits/3.ogg create mode 100644 assets/sounds/hits/4.ogg create mode 100644 assets/sounds/hits/5.ogg create mode 100644 assets/sounds/hits/6.ogg create mode 100644 assets/sounds/hits/7.ogg create mode 100644 assets/sounds/hits/8.ogg create mode 100644 assets/sounds/hits/9.ogg create mode 100644 assets/sounds/hits/README.txt create mode 100644 assets/sounds/monster_growl.wav create mode 100644 assets/sounds/thunder.ogg create mode 100644 hxformat.json create mode 100644 source/AssetPaths.hx create mode 100644 source/Main.hx create mode 100644 source/PlayState.hx create mode 100644 source/core/Entity.hx create mode 100644 source/core/MenuState.hx create mode 100644 source/core/entities/Player.hx create mode 100644 source/core/entities/Sekeleton.hx create mode 100644 source/core/enums/EnityTypes.hx create mode 100644 source/levels/Level1.hx create mode 100644 source/utils/Constants.hx create mode 100644 source/utils/Debug.hx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3c021a --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Build Folders +export/ \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..89e20ed --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "openfl.lime-vscode-extension", + "redhat.vscode-xml" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5e9a7a1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Build + Debug", + "type": "lime", + "request": "launch" + }, + { + "name": "Debug", + "type": "lime", + "request": "launch", + "preLaunchTask": null + }, + { + "name": "Macro", + "type": "haxe-eval", + "request": "launch" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4c1a0e9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "search.exclude": { + "export/**/*.hx": true + }, + "[haxe]": { + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "editor.codeActionsOnSave": { + "source.sortImports": true + } + }, + "haxe.enableExtendedIndentation": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..16a7764 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,13 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "lime", + "command": "test", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/Project.xml b/Project.xml new file mode 100644 index 0000000..984b12a --- /dev/null +++ b/Project.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/data/fonts/C800.ttf b/assets/data/fonts/C800.ttf new file mode 100644 index 0000000..e57f558 Binary files /dev/null and b/assets/data/fonts/C800.ttf differ diff --git a/assets/data/fonts/Lazer84.ttf b/assets/data/fonts/Lazer84.ttf new file mode 100644 index 0000000..369779c Binary files /dev/null and b/assets/data/fonts/Lazer84.ttf differ diff --git a/assets/data/fonts/minecraftia.ttf b/assets/data/fonts/minecraftia.ttf new file mode 100644 index 0000000..7247ad7 Binary files /dev/null and b/assets/data/fonts/minecraftia.ttf differ diff --git a/assets/images/aswani.png b/assets/images/aswani.png new file mode 100644 index 0000000..aca4344 Binary files /dev/null and b/assets/images/aswani.png differ diff --git a/assets/images/enemy.png b/assets/images/enemy.png new file mode 100644 index 0000000..51ed5a0 Binary files /dev/null and b/assets/images/enemy.png differ diff --git a/assets/images/heart.png b/assets/images/heart.png new file mode 100644 index 0000000..f7d9baf Binary files /dev/null and b/assets/images/heart.png differ diff --git a/assets/images/icon.png b/assets/images/icon.png new file mode 100644 index 0000000..221a69c Binary files /dev/null and b/assets/images/icon.png differ diff --git a/assets/images/images-go-here.txt b/assets/images/images-go-here.txt new file mode 100644 index 0000000..e69de29 diff --git a/assets/images/player_shadow.png b/assets/images/player_shadow.png new file mode 100644 index 0000000..1d5ab29 Binary files /dev/null and b/assets/images/player_shadow.png differ diff --git a/assets/images/tileset.png b/assets/images/tileset.png new file mode 100644 index 0000000..79d57eb Binary files /dev/null and b/assets/images/tileset.png differ diff --git a/assets/music/TitleMusic.ogg b/assets/music/TitleMusic.ogg new file mode 100644 index 0000000..16ddf87 Binary files /dev/null and b/assets/music/TitleMusic.ogg differ diff --git a/assets/music/music-goes-here.txt b/assets/music/music-goes-here.txt new file mode 100644 index 0000000..e69de29 diff --git a/assets/sounds/atmosphere1.ogg b/assets/sounds/atmosphere1.ogg new file mode 100644 index 0000000..e811dc2 Binary files /dev/null and b/assets/sounds/atmosphere1.ogg differ diff --git a/assets/sounds/cicada1.ogg b/assets/sounds/cicada1.ogg new file mode 100644 index 0000000..ec2251a Binary files /dev/null and b/assets/sounds/cicada1.ogg differ diff --git a/assets/sounds/gotsomething.mp3 b/assets/sounds/gotsomething.mp3 new file mode 100644 index 0000000..5a6934b Binary files /dev/null and b/assets/sounds/gotsomething.mp3 differ diff --git a/assets/sounds/heart.wav b/assets/sounds/heart.wav new file mode 100644 index 0000000..6233a23 Binary files /dev/null and b/assets/sounds/heart.wav differ diff --git a/assets/sounds/heartbeat_fast_0.wav b/assets/sounds/heartbeat_fast_0.wav new file mode 100644 index 0000000..7fd7b2a Binary files /dev/null and b/assets/sounds/heartbeat_fast_0.wav differ diff --git a/assets/sounds/hits/1.ogg b/assets/sounds/hits/1.ogg new file mode 100644 index 0000000..d0169ab Binary files /dev/null and b/assets/sounds/hits/1.ogg differ diff --git a/assets/sounds/hits/10.ogg b/assets/sounds/hits/10.ogg new file mode 100644 index 0000000..33f2541 Binary files /dev/null and b/assets/sounds/hits/10.ogg differ diff --git a/assets/sounds/hits/11.ogg b/assets/sounds/hits/11.ogg new file mode 100644 index 0000000..c547ca1 Binary files /dev/null and b/assets/sounds/hits/11.ogg differ diff --git a/assets/sounds/hits/12.ogg b/assets/sounds/hits/12.ogg new file mode 100644 index 0000000..96d8689 Binary files /dev/null and b/assets/sounds/hits/12.ogg differ diff --git a/assets/sounds/hits/13.ogg b/assets/sounds/hits/13.ogg new file mode 100644 index 0000000..2aa3611 Binary files /dev/null and b/assets/sounds/hits/13.ogg differ diff --git a/assets/sounds/hits/14.ogg b/assets/sounds/hits/14.ogg new file mode 100644 index 0000000..fb0aef7 Binary files /dev/null and b/assets/sounds/hits/14.ogg differ diff --git a/assets/sounds/hits/15.ogg b/assets/sounds/hits/15.ogg new file mode 100644 index 0000000..9fd6688 Binary files /dev/null and b/assets/sounds/hits/15.ogg differ diff --git a/assets/sounds/hits/16.ogg b/assets/sounds/hits/16.ogg new file mode 100644 index 0000000..73fc472 Binary files /dev/null and b/assets/sounds/hits/16.ogg differ diff --git a/assets/sounds/hits/17.ogg b/assets/sounds/hits/17.ogg new file mode 100644 index 0000000..c634e2c Binary files /dev/null and b/assets/sounds/hits/17.ogg differ diff --git a/assets/sounds/hits/18.ogg b/assets/sounds/hits/18.ogg new file mode 100644 index 0000000..aaf2e77 Binary files /dev/null and b/assets/sounds/hits/18.ogg differ diff --git a/assets/sounds/hits/2.ogg b/assets/sounds/hits/2.ogg new file mode 100644 index 0000000..9c8b8b7 Binary files /dev/null and b/assets/sounds/hits/2.ogg differ diff --git a/assets/sounds/hits/3.ogg b/assets/sounds/hits/3.ogg new file mode 100644 index 0000000..45be628 Binary files /dev/null and b/assets/sounds/hits/3.ogg differ diff --git a/assets/sounds/hits/4.ogg b/assets/sounds/hits/4.ogg new file mode 100644 index 0000000..abb7e9f Binary files /dev/null and b/assets/sounds/hits/4.ogg differ diff --git a/assets/sounds/hits/5.ogg b/assets/sounds/hits/5.ogg new file mode 100644 index 0000000..c616fdd Binary files /dev/null and b/assets/sounds/hits/5.ogg differ diff --git a/assets/sounds/hits/6.ogg b/assets/sounds/hits/6.ogg new file mode 100644 index 0000000..2928a3b Binary files /dev/null and b/assets/sounds/hits/6.ogg differ diff --git a/assets/sounds/hits/7.ogg b/assets/sounds/hits/7.ogg new file mode 100644 index 0000000..2c1155b Binary files /dev/null and b/assets/sounds/hits/7.ogg differ diff --git a/assets/sounds/hits/8.ogg b/assets/sounds/hits/8.ogg new file mode 100644 index 0000000..5f6249e Binary files /dev/null and b/assets/sounds/hits/8.ogg differ diff --git a/assets/sounds/hits/9.ogg b/assets/sounds/hits/9.ogg new file mode 100644 index 0000000..992a534 Binary files /dev/null and b/assets/sounds/hits/9.ogg differ diff --git a/assets/sounds/hits/README.txt b/assets/sounds/hits/README.txt new file mode 100644 index 0000000..537ebef --- /dev/null +++ b/assets/sounds/hits/README.txt @@ -0,0 +1,4 @@ +Adapted from Punch, slap, n' kick.wav +by CGEffex +http://freesound.org/people/CGEffex/sounds/98341/ +http://creativecommons.org/licenses/by/3.0/ \ No newline at end of file diff --git a/assets/sounds/monster_growl.wav b/assets/sounds/monster_growl.wav new file mode 100644 index 0000000..9fc1c91 Binary files /dev/null and b/assets/sounds/monster_growl.wav differ diff --git a/assets/sounds/thunder.ogg b/assets/sounds/thunder.ogg new file mode 100644 index 0000000..1053d6b Binary files /dev/null and b/assets/sounds/thunder.ogg differ diff --git a/hxformat.json b/hxformat.json new file mode 100644 index 0000000..66cb386 --- /dev/null +++ b/hxformat.json @@ -0,0 +1,15 @@ +{ + "lineEnds": { + "leftCurly": "both", + "rightCurly": "both", + "objectLiteralCurly": { + "leftCurly": "after" + } + }, + "sameLine": { + "ifElse": "next", + "doWhile": "next", + "tryBody": "next", + "tryCatch": "next" + } +} 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); + } +} -- cgit v1.2.3