sconepunk

A collection of utility classes for HaxePunk development.
https://github.com/wscones/sconepunk

To install, run:

haxelib install sconepunk 0.0.5 

See using Haxelib in Haxelib documentation for more information.

README.md

README

What is sconepunk?

  • sconepunk (current version 0.0.4) is a simple collection of utility classes that I frequently use for HaxePunk development.
  • Currently, it's very bare-bones and mostly for personal use, but I hope to add more useful features that might benefit others :)

What does sconepunk contain?

packages

sconepunk
sconepunk.components
sconepunk.entities
sconepunk.events
sconepunk.math
sconepunk.time
sconepunk.utils

sconepunk

TimedScene

An extension of HaxePunk's Scene class that adds functionality for a fixedUpdate, as well as the logic for calling fixedUpdate in any TimedEntities

TimedEntity

An extension of HaxePunk's Entity class that adds a fixedUpdate function, which is called on every tick, rather than every frame

sconepunk.components

Component

Base class for all components. Extend this to create components; Contains a reference to its parent entity

How to use:

// reference another component on the same entity
entity.getComponent(OtherComponentType).doSomething();

// broadcast an event
entity.broadcastEvent(new TestEvent(TestEvent.TEST));

sconepunk.entities

ComponentEntity

The core of the bare-bones component system;

How to use:

// adding a component
ComponentEntity player = new ComponentEntity();
player.addComponent(new MovementComponent(player));

// accessing a component
player.getComponent(MovementComponent).enabled = false;

sconepunk.entities

EventManager

A simple singleton used for broadcasting events to components (using openFL Events + EventDispatchers); Used internally within ComponentEntity

sconepunk.math

SconeMath

static public function ApproxFloat(float1:Float, float2:Float, margin:Float):Bool
static public function ApproxPoint(point1_x:Float, point1_y:Float, point2_x:Float, point2_y:Float, margin:Float):Bool
static public function CollideX(entity1_x:Float, entity2_left:Float, entity2_right:Float):Bool
static public function CollideY(entity1_y:Float, entity2_top:Float, entity2_bottom:Float):Bool
static public function GetAngleOffset(angle:Float, length:Float = 1):Vector2D

sconepunk.time

Time

An attempt to emulate Unity's Time class

sconepunk.utils

Random in-progress stuff mostly

Constants

JoystickWrapper

Structures

Types

Contributors
wednesdayscones
Version
0.0.5
Published
8 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub