This file contains hidden or 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
package states; | |
import flixel.FlxBasic; | |
import flixel.FlxG; | |
import flixel.graphics.frames.FlxBitmapFont; | |
import flixel.graphics.frames.FlxFrame; | |
import flixel.math.FlxMatrix; | |
import flixel.math.FlxPoint; | |
import flixel.math.FlxRect; | |
import flixel.text.FlxBitmapText; |
This file contains hidden or 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
import flixel.FlxG; | |
class PixelateShader extends flixel.system.FlxAssets.FlxShader | |
{ | |
var debug = false; | |
var enabled = true; | |
@:glFragmentSource(' | |
#pragma header |
This file contains hidden or 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
var button = new FlxButton(X, Y); | |
#if js // access to JS packages | |
if (FlxG.onMobile) { // on mobile device | |
button.onDown.callback = () -> { | |
js.Browser.navigator.vibrate(5); // vibrate breifly to indicate button was pressed | |
}; | |
} | |
#end |
This file contains hidden or 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
package states; | |
import flixel.util.FlxSpriteUtil; | |
import shaders.Outline; | |
import openfl.geom.Matrix; | |
import openfl.geom.Point; | |
import flixel.FlxCamera; | |
import flixel.util.FlxColor; | |
import flixel.FlxSprite; | |
import flixel.FlxG; |
This file contains hidden or 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
package cameras; | |
import flixel.FlxG; | |
import flixel.math.FlxPoint; | |
import flixel.FlxCamera; | |
class CameraUtils { | |
// getCenterPoint returns the world coordinate that the center of the given camera is located at | |
public static function getCenterPoint(cam:FlxCamera, ?p:FlxPoint):FlxPoint { |
This file contains hidden or 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
allCollisionAxes.sort((axis1, axis2) -> Float.compare(Math.abs(axis1.translationVector), Math.abs(axis2.translationVector))); | |
Vector relativeMovement = body1.speed.minus(body2.speed); | |
float dotProd; | |
for (Axis axis : allCollisionAxes) { | |
dotProd = relativeMovement.dot(axis); | |
if (dotProd != 0 && !sameSign(dotProd, axisOver.translationVector)) { | |
resolutionAxis = axis; | |
resolutionDistance = axis.translationVector; | |
return; | |
} |
This file contains hidden or 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
axes.sort((o1, o2) -> Float.compare(Math.abs(o1.overlap), Math.abs(o2.overlap))); | |
BitPoint relativeMovement = body.lastAttempt.minus(otherBody.lastAttempt); | |
float dotProd; | |
for (AxisOverlap axisOver : axes) { | |
dotProd = relativeMovement.dot(axisOver.axis); | |
if (dotProd != 0 && !sameSign(dotProd, axisOver.overlap)) { | |
axis = axisOver.axis; | |
distance = axisOver.overlap; | |
return; | |
} |
This file contains hidden or 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
Rectangle intersection = intersection(body1.rectangle, body2.rectangle);if (intersection != null) { | |
resolve(); | |
} |