-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Engine
- Loading branch information
0 parents
commit c91541f
Showing
31 changed files
with
843 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"openfl.lime-vscode-extension", | ||
"redhat.vscode-xml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"search.exclude": { | ||
"export/**/*.*": true | ||
}, | ||
"[haxe]": { | ||
"editor.formatOnSave": true, | ||
"editor.formatOnSaveMode":"modifications", | ||
"editor.formatOnPaste": false, | ||
"editor.codeActionsOnSave": { | ||
"source.sortImports": "explicit" | ||
} | ||
}, | ||
"haxe.enableExtendedIndentation": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "lime", | ||
"command": "test", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<project xmlns="http://lime.openfl.org/project/1.0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://lime.openfl.org/project/1.0.4 http://lime.openfl.org/xsd/project-1.0.4.xsd"> | ||
|
||
<!-- _________________________ Application Settings _________________________ --> | ||
|
||
<app title="FlxCamera: Orb Engine" file="OrbEngine" main="Main" version="1.0.0" company="megalives717" /> | ||
|
||
<!--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="640" height="480" fps="60" background="#000000" hardware="true" vsync="false" /> | ||
|
||
<!--HTML5-specific--> | ||
<window if="html5" resizable="true" /> | ||
|
||
<!--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" exclude="*.ogg" if="web" /> | ||
<assets path="assets" exclude="*.mp3" unless="web" /> | ||
|
||
<!-- _______________________________ 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" /> | ||
|
||
<haxelib name="flxanimate" /> | ||
|
||
<!-- ______________________________ Haxedefines _____________________________ --> | ||
|
||
<!--Remove the legacy health system--> | ||
<haxedef name="FLX_NO_HEALTH" /> | ||
|
||
<!--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 for Flash target--> | ||
<!--<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 _______________________________ --> | ||
|
||
<icon path="assets/images/Orb.png" /> | ||
</project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add other file format(s) data assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add ttf file(s) fonts assets |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add png file(s) images assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add mp3/ogg file(s) music assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add mp3/ogg file(s) sounds assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"lineEnds": { | ||
"leftCurly": "both", | ||
"rightCurly": "both", | ||
"objectLiteralCurly": { | ||
"leftCurly": "after" | ||
} | ||
}, | ||
"sameLine": { | ||
"ifElse": "next", | ||
"doWhile": "next", | ||
"tryBody": "next", | ||
"tryCatch": "next" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package; | ||
|
||
import flixel.FlxGame; | ||
import flixel.FlxSprite; | ||
import openfl.display.Sprite; | ||
|
||
class Main extends Sprite | ||
{ | ||
public function new() | ||
{ | ||
super(); | ||
|
||
FlxSprite.defaultAntialiasing = true; | ||
addChild(new FlxGame(640, 480, PlayState)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
package; | ||
|
||
import flixel.FlxCamera; | ||
import flixel.FlxG; | ||
import flixel.FlxSprite; | ||
import flixel.FlxState; | ||
import flixel.addons.display.FlxBackdrop; | ||
import flixel.addons.nape.FlxNapeSpace; | ||
import flixel.math.FlxMath; | ||
import haxe.EnumTools; | ||
import nape.phys.Material; | ||
import props.BorderSlice; | ||
import props.Orb; | ||
import props.OtherOrb; | ||
import props.PlayerOrb; | ||
import ui.DeadzoneOverlay; | ||
import ui.HUD; | ||
|
||
using flixel.util.FlxSpriteUtil; | ||
|
||
/** | ||
* @author TiagoLr ( ~~~ProG4mr~~~ ) | ||
*/ | ||
class PlayState extends FlxState | ||
{ | ||
static var followStyles = EnumTools.createAll(FlxCameraFollowStyle); | ||
|
||
var player:PlayerOrb; | ||
var hud:HUD; | ||
var deadzoneOverlay:DeadzoneOverlay; | ||
|
||
override public function create():Void | ||
{ | ||
FlxNapeSpace.init(); | ||
|
||
// final levelMinX = -FlxG.stage.stageWidth; | ||
// final levelMaxX = FlxG.stage.stageWidth; | ||
// final levelMinY = -FlxG.stage.stageHeight; | ||
// final levelMaxY = FlxG.stage.stageHeight; | ||
final levelMinX = 0; | ||
final levelMaxX = FlxG.stage.stageWidth * 2; | ||
final levelMinY = 0; | ||
final levelMaxY = FlxG.stage.stageHeight * 2; | ||
final levelWidth = levelMaxX - levelMinX; | ||
final levelHeight = levelMaxY - levelMinY; | ||
|
||
super.create(); | ||
|
||
FlxNapeSpace.velocityIterations = 5; | ||
FlxNapeSpace.positionIterations = 5; | ||
|
||
// repeating backdrop | ||
final backdrop = new FlxBackdrop("assets/images/FloorTexture.png"); | ||
#if debug | ||
backdrop.ignoreDrawDebug = true; | ||
#end | ||
add(backdrop); | ||
|
||
// create nape wall colliders | ||
final border = 10; | ||
FlxNapeSpace.createWalls(levelMinX + border, levelMinY + border, levelMaxX - border, levelMaxY - border, border, new Material(1.0, 0.0, 0.0, 1)); | ||
|
||
// Walls border sprite | ||
final borderSprite = new BorderSlice(levelMinX, levelMinY, levelWidth, levelHeight); | ||
add(borderSprite); | ||
|
||
// Player orb | ||
player = new PlayerOrb(levelMinX + levelWidth / 2, levelMinY + levelHeight / 2); | ||
add(player); | ||
// if the player is using a virtual pad, add it to the state | ||
if (player.controls.virtualPad != null) | ||
add(player.controls.virtualPad); | ||
|
||
// Other orbs | ||
for (i in 0...5) | ||
{ | ||
final orb = new OtherOrb(0, 0, i); | ||
add(orb); | ||
orb.randomizeVelocity(); | ||
|
||
// randomize spawn position until it's far enough from the player, up to 20 times | ||
var tries = 20; | ||
do orb.randomizePosition(levelMinX, levelMaxX, levelMinY, levelMaxY) | ||
while (Math.abs(orb.x - player.x) < 200 && Math.abs(orb.y - player.y) < 200 && tries-- > 0); | ||
} | ||
|
||
hud = new HUD(); | ||
add(hud); | ||
|
||
// Camera Overlay | ||
deadzoneOverlay = new DeadzoneOverlay(); | ||
add(deadzoneOverlay); | ||
|
||
FlxG.camera.pixelPerfectRender = false; | ||
FlxG.camera.setScrollBounds(levelMinX, levelMaxX, levelMinY, levelMaxY); | ||
FlxG.worldBounds.set(levelMinX, levelMinY, levelWidth, levelHeight); | ||
FlxG.camera.follow(player, followStyles[0], 1); | ||
deadzoneOverlay.redraw(FlxG.camera); // now that deadzone is present | ||
} | ||
|
||
override public function update(elapsed:Float):Void | ||
{ | ||
super.update(elapsed); | ||
|
||
final justPressed = FlxG.keys.justPressed; | ||
|
||
if (justPressed.Y) setStyle(1); | ||
if (justPressed.H) setStyle(-1); | ||
|
||
if (justPressed.U) setLerp(.1); | ||
if (justPressed.J) setLerp(-.1); | ||
|
||
if (justPressed.I) setLead(.5); | ||
if (justPressed.K) setLead(-.5); | ||
|
||
if (justPressed.O) setZoom(.1); | ||
if (justPressed.L) setZoom(-.1); | ||
|
||
if (justPressed.M) FlxG.camera.shake(); | ||
} | ||
|
||
public function setZoom(delta:Float) | ||
{ | ||
final newZoom = FlxG.camera.zoom + delta; | ||
FlxG.camera.zoom = FlxMath.bound(Math.round(newZoom * 10) / 10, 0.5, 4); | ||
hud.updateZoom(FlxG.camera.zoom); | ||
} | ||
|
||
function setLead(delta:Float) | ||
{ | ||
var cam = FlxG.camera; | ||
cam.followLead.x += delta; | ||
cam.followLead.y += delta; | ||
|
||
if (cam.followLead.x < 0) | ||
{ | ||
cam.followLead.x = 0; | ||
cam.followLead.y = 0; | ||
} | ||
|
||
hud.updateCamLead(cam.followLead.x); | ||
} | ||
|
||
function setLerp(delta:Float) | ||
{ | ||
var cam = FlxG.camera; | ||
cam.followLerp += delta; | ||
cam.followLerp = Math.round(10 * cam.followLerp) / 10; // adding or subtracting .1 causes roundoff errors | ||
hud.updateCamLerp(cam.followLerp); | ||
} | ||
|
||
function setStyle(delta:Int) | ||
{ | ||
final nextStyleIndex = (followStyles.indexOf(FlxG.camera.style) + delta) % followStyles.length; | ||
FlxG.camera.follow(player, followStyles[nextStyleIndex], FlxG.camera.followLerp); | ||
|
||
deadzoneOverlay.redraw(FlxG.camera); | ||
|
||
hud.updateStyle(FlxG.camera.style); | ||
} | ||
} |
Oops, something went wrong.