Skip to content

Instantly share code, notes, and snippets.

@ibilon
Last active August 29, 2015 14:02
Show Gist options
  • Save ibilon/d2c255e1ed7c1a0b21cb to your computer and use it in GitHub Desktop.
Save ibilon/d2c255e1ed7c1a0b21cb to your computer and use it in GitHub Desktop.
Proposed API for HaxePunk 3.0
  • haxepunk
    • graphics
      • Graphic
      • Image
      • Text
      • AnimatedSprite
      • TileMap
      • Mesh
      • Light
      • ParticleEmitter
      • GraphicList
      • Atlas
    • inputs
      • Input
      • Mouse
      • Keyboard
      • Joystick
      • Touch
    • masks
      • Mask
      • Circle
      • Ellipse
      • Grid
      • Polygon
      • Rectangle
    • math
      • Point
      • Rectangle
    • tweens
      • Tween
      • AlarmTween
      • MultiVarTween
      • EaseFunctions
      • motion
        • CircularMotionTween
        • CubicMotionTween
        • LinearMotionTween
        • LinearPathTween
        • QuadMotionTween
        • QuadPathTween
    • utils
      • DataStorage
      • LibInfo
    • Camera
    • DebugConsole
    • Engine
    • Entity
    • Preloader
    • Scene
    • Sound
    • Value
typedef SolidType = Either2<String, Array<String>>;
typedef Colliders = Either3<Entity, Point, Mask>;
class SceneNode
{
public var position:Point;
public var scene:Scene;
public var x:Float;
public var y:Float;
}
class Entity extends SceneNode
{
public var visible:Bool;
public var collidable:Bool;
public var name:String;
public var type:String;
public var mask:Mask;
public var graphic:Graphic;
public var layer:Float;
public function new(?point:Point, ?graphic:Graphic, ?mask:Mask):Void;
public function added():Void;
public function collided(e:Entity, i:CollideInfo):Bool;
public function removed():Void;
public function update():Void;
public function setHitboxTo(g:Graphic):Void;
public function setHitbox(rectangle:Rectangle):Void;
public function distanceWith(with:Colliders):Float;
public function collideWith(with:Colliders):Bool;
public function collisions(with:SolidType):Array<Entity>;
public function moveBy(point:Point, ?solid:SolidType):Void;
public function moveTo(point:Point, ?solid:SolidType):Void;
public function moveTowards(point:Point, amount:Float, ?solid:SolidType):Void;
public function moveAtAngle(angle:Float, amount:Float, ?solid:SolidType):Void;
public function addGraphic(graphic:Graphic):Graphic;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment