diff options
author | Indrajith K L | 2022-03-22 02:20:02 +0530 |
---|---|---|
committer | Indrajith K L | 2022-03-22 02:20:02 +0530 |
commit | f5e60ac6142f5f3d71f5a6edc581094df840f12e (patch) | |
tree | 68b7071b9862082ce3d0943b8b1f76744e411642 | |
download | YEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.tar.gz YEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.tar.bz2 YEAD-haxe-f5e60ac6142f5f3d71f5a6edc581094df840f12e.zip |
Initial Commit
* Basic Entity System Implemented
56 files changed, 398 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="utf-8"?> +<project xmlns="http://lime.software/project/1.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://lime.software/project/1.0.2 http://lime.software/xsd/project-1.0.2.xsd"> + + <!-- _________________________ Application Settings _________________________ --> + + <app title="Your Enemy is in Another Dimension" file="Your Enemy is in Another Dimension" main="Main" version="0.0.1" company="HaxeFlixel" /> + + <!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file + or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"--> + <app preloader="flixel.system.FlxPreloader" /> + + <!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2--> + <set name="SWF_VERSION" value="11.8" /> + + <!-- ____________________________ Window Settings ___________________________ --> + + <!--These window settings apply to all targets--> + <window width="800" height="600" fps="60" background="#000000" hardware="true" vsync="false" /> + + <!--HTML5-specific--> + <window if="html5" resizable="false" /> + + <!--Desktop-specific--> + <window if="desktop" orientation="landscape" fullscreen="false" resizable="true" /> + + <!--Mobile-specific--> + <window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" /> + + <!-- _____________________________ Path Settings ____________________________ --> + + <set name="BUILD_DIR" value="export" /> + <source path="source" /> + <assets path="assets" /> + + <!-- _______________________________ Libraries ______________________________ --> + + <haxelib name="flixel" /> + + <!--In case you want to use the addons package--> + <haxelib name="flixel-addons" /> + + <!--In case you want to use the ui package--> + <haxelib name="flixel-ui" /> + + <!--In case you want to use nape with flixel--> + <!--<haxelib name="nape-haxe4" />--> + + <!-- ______________________________ Haxedefines _____________________________ --> + + <!--Enable the Flixel core recording system--> + <!--<haxedef name="FLX_RECORD" />--> + + <!--Disable the right and middle mouse buttons--> + <!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />--> + + <!--Disable the native cursor API on Flash--> + <!--<haxedef name="FLX_NO_NATIVE_CURSOR" />--> + + <!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game--> + <haxedef name="FLX_NO_MOUSE" if="mobile" /> + <haxedef name="FLX_NO_KEYBOARD" if="mobile" /> + <haxedef name="FLX_NO_TOUCH" if="desktop" /> + <!--<haxedef name="FLX_NO_GAMEPAD" />--> + + <!--Disable the Flixel core sound tray--> + <!--<haxedef name="FLX_NO_SOUND_TRAY" />--> + + <!--Disable the Flixel sound management code--> + <!--<haxedef name="FLX_NO_SOUND_SYSTEM" />--> + + <!--Disable the Flixel core focus lost screen--> + <!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />--> + + <!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!--> + <haxedef name="FLX_NO_DEBUG" unless="debug" /> + + <!--Enable this for Nape release builds for a serious peformance improvement--> + <haxedef name="NAPE_RELEASE_BUILD" unless="debug" /> + + <!-- _________________________________ Custom _______________________________ --> + + <!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)--> +</project> diff --git a/assets/data/fonts/C800.ttf b/assets/data/fonts/C800.ttf Binary files differnew file mode 100644 index 0000000..e57f558 --- /dev/null +++ b/assets/data/fonts/C800.ttf diff --git a/assets/data/fonts/Lazer84.ttf b/assets/data/fonts/Lazer84.ttf Binary files differnew file mode 100644 index 0000000..369779c --- /dev/null +++ b/assets/data/fonts/Lazer84.ttf diff --git a/assets/data/fonts/minecraftia.ttf b/assets/data/fonts/minecraftia.ttf Binary files differnew file mode 100644 index 0000000..7247ad7 --- /dev/null +++ b/assets/data/fonts/minecraftia.ttf diff --git a/assets/images/aswani.png b/assets/images/aswani.png Binary files differnew file mode 100644 index 0000000..aca4344 --- /dev/null +++ b/assets/images/aswani.png diff --git a/assets/images/enemy.png b/assets/images/enemy.png Binary files differnew file mode 100644 index 0000000..51ed5a0 --- /dev/null +++ b/assets/images/enemy.png diff --git a/assets/images/heart.png b/assets/images/heart.png Binary files differnew file mode 100644 index 0000000..f7d9baf --- /dev/null +++ b/assets/images/heart.png diff --git a/assets/images/icon.png b/assets/images/icon.png Binary files differnew file mode 100644 index 0000000..221a69c --- /dev/null +++ b/assets/images/icon.png diff --git a/assets/images/images-go-here.txt b/assets/images/images-go-here.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/assets/images/images-go-here.txt diff --git a/assets/images/player_shadow.png b/assets/images/player_shadow.png Binary files differnew file mode 100644 index 0000000..1d5ab29 --- /dev/null +++ b/assets/images/player_shadow.png diff --git a/assets/images/tileset.png b/assets/images/tileset.png Binary files differnew file mode 100644 index 0000000..79d57eb --- /dev/null +++ b/assets/images/tileset.png diff --git a/assets/music/TitleMusic.ogg b/assets/music/TitleMusic.ogg Binary files differnew file mode 100644 index 0000000..16ddf87 --- /dev/null +++ b/assets/music/TitleMusic.ogg diff --git a/assets/music/music-goes-here.txt b/assets/music/music-goes-here.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/assets/music/music-goes-here.txt diff --git a/assets/sounds/atmosphere1.ogg b/assets/sounds/atmosphere1.ogg Binary files differnew file mode 100644 index 0000000..e811dc2 --- /dev/null +++ b/assets/sounds/atmosphere1.ogg diff --git a/assets/sounds/cicada1.ogg b/assets/sounds/cicada1.ogg Binary files differnew file mode 100644 index 0000000..ec2251a --- /dev/null +++ b/assets/sounds/cicada1.ogg diff --git a/assets/sounds/gotsomething.mp3 b/assets/sounds/gotsomething.mp3 Binary files differnew file mode 100644 index 0000000..5a6934b --- /dev/null +++ b/assets/sounds/gotsomething.mp3 diff --git a/assets/sounds/heart.wav b/assets/sounds/heart.wav Binary files differnew file mode 100644 index 0000000..6233a23 --- /dev/null +++ b/assets/sounds/heart.wav diff --git a/assets/sounds/heartbeat_fast_0.wav b/assets/sounds/heartbeat_fast_0.wav Binary files differnew file mode 100644 index 0000000..7fd7b2a --- /dev/null +++ b/assets/sounds/heartbeat_fast_0.wav diff --git a/assets/sounds/hits/1.ogg b/assets/sounds/hits/1.ogg Binary files differnew file mode 100644 index 0000000..d0169ab --- /dev/null +++ b/assets/sounds/hits/1.ogg diff --git a/assets/sounds/hits/10.ogg b/assets/sounds/hits/10.ogg Binary files differnew file mode 100644 index 0000000..33f2541 --- /dev/null +++ b/assets/sounds/hits/10.ogg diff --git a/assets/sounds/hits/11.ogg b/assets/sounds/hits/11.ogg Binary files differnew file mode 100644 index 0000000..c547ca1 --- /dev/null +++ b/assets/sounds/hits/11.ogg diff --git a/assets/sounds/hits/12.ogg b/assets/sounds/hits/12.ogg Binary files differnew file mode 100644 index 0000000..96d8689 --- /dev/null +++ b/assets/sounds/hits/12.ogg diff --git a/assets/sounds/hits/13.ogg b/assets/sounds/hits/13.ogg Binary files differnew file mode 100644 index 0000000..2aa3611 --- /dev/null +++ b/assets/sounds/hits/13.ogg diff --git a/assets/sounds/hits/14.ogg b/assets/sounds/hits/14.ogg Binary files differnew file mode 100644 index 0000000..fb0aef7 --- /dev/null +++ b/assets/sounds/hits/14.ogg diff --git a/assets/sounds/hits/15.ogg b/assets/sounds/hits/15.ogg Binary files differnew file mode 100644 index 0000000..9fd6688 --- /dev/null +++ b/assets/sounds/hits/15.ogg diff --git a/assets/sounds/hits/16.ogg b/assets/sounds/hits/16.ogg Binary files differnew file mode 100644 index 0000000..73fc472 --- /dev/null +++ b/assets/sounds/hits/16.ogg diff --git a/assets/sounds/hits/17.ogg b/assets/sounds/hits/17.ogg Binary files differnew file mode 100644 index 0000000..c634e2c --- /dev/null +++ b/assets/sounds/hits/17.ogg diff --git a/assets/sounds/hits/18.ogg b/assets/sounds/hits/18.ogg Binary files differnew file mode 100644 index 0000000..aaf2e77 --- /dev/null +++ b/assets/sounds/hits/18.ogg diff --git a/assets/sounds/hits/2.ogg b/assets/sounds/hits/2.ogg Binary files differnew file mode 100644 index 0000000..9c8b8b7 --- /dev/null +++ b/assets/sounds/hits/2.ogg diff --git a/assets/sounds/hits/3.ogg b/assets/sounds/hits/3.ogg Binary files differnew file mode 100644 index 0000000..45be628 --- /dev/null +++ b/assets/sounds/hits/3.ogg diff --git a/assets/sounds/hits/4.ogg b/assets/sounds/hits/4.ogg Binary files differnew file mode 100644 index 0000000..abb7e9f --- /dev/null +++ b/assets/sounds/hits/4.ogg diff --git a/assets/sounds/hits/5.ogg b/assets/sounds/hits/5.ogg Binary files differnew file mode 100644 index 0000000..c616fdd --- /dev/null +++ b/assets/sounds/hits/5.ogg diff --git a/assets/sounds/hits/6.ogg b/assets/sounds/hits/6.ogg Binary files differnew file mode 100644 index 0000000..2928a3b --- /dev/null +++ b/assets/sounds/hits/6.ogg diff --git a/assets/sounds/hits/7.ogg b/assets/sounds/hits/7.ogg Binary files differnew file mode 100644 index 0000000..2c1155b --- /dev/null +++ b/assets/sounds/hits/7.ogg diff --git a/assets/sounds/hits/8.ogg b/assets/sounds/hits/8.ogg Binary files differnew file mode 100644 index 0000000..5f6249e --- /dev/null +++ b/assets/sounds/hits/8.ogg diff --git a/assets/sounds/hits/9.ogg b/assets/sounds/hits/9.ogg Binary files differnew file mode 100644 index 0000000..992a534 --- /dev/null +++ b/assets/sounds/hits/9.ogg 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 Binary files differnew file mode 100644 index 0000000..9fc1c91 --- /dev/null +++ b/assets/sounds/monster_growl.wav diff --git a/assets/sounds/thunder.ogg b/assets/sounds/thunder.ogg Binary files differnew file mode 100644 index 0000000..1053d6b --- /dev/null +++ b/assets/sounds/thunder.ogg 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); + } +} |