GithubHelp home page GithubHelp logo

happy-ferret / artemists Goto Github PK

View Code? Open in Web Editor NEW

This project forked from darkoverlordofdata/artemists

0.0 2.0 0.0 46.44 MB

Port of artemis-framework to typescript.

Home Page: https://darkoverlordofdata.com/artemists/

License: Other

CoffeeScript 15.46% JavaScript 1.73% Shell 0.07% TypeScript 71.82% Smarty 4.53% HTML 5.15% GLSL 1.25%

artemists's Introduction

Artemis

Build Status

Port of artemis-framework to typescript. ArtemisTS requires TypeScript >= 1.5

Play the demo at https://darkoverlordofdata.com/spaceship-warrior-ts/

The demo is a port of https://github.com/Flet/spaceship-warrior-redux and requires Pixi.js 3.0.7

Build

requires bower and bower-installer

$ git clone https://github.com/darkoverlordofdata/artemists
$ cd artemists
$ npm install
$ tools/configure
$ npm run build
$ npm test

extensions

Components declare as pooled are auto pooled:

@Pooled()
export class Position extends PooledComponent {
public static className = 'Position';
    public initialize(x:number=0, y:number=0) {
        this.x = x;
        this.y = y;
    }
    public x:number;
    public y:number;
}

BlackBoard & Entity Templates inspired by artemis_CSharp:

@EntityTemplate('player')
export class PlayerTemplate implements artemis.IEntityTemplate {

    public buildEntity(entity:Entity, world:World, x:number, y:number):Entity {

        entity.addComponent(Position, x, y);
        entity.addComponent(Velocity, 0, 0);
        entity.addComponent(Bounds, 43);
        entity.addComponent(Health, 100, 100);
        entity.addComponent(Player);
        entity.addComponent(Sprite, 'fighter', 0x5dff81), (sprite) => {
            sprite.layer = Layer.ACTORS_3;
            sprite.addTo(EntitySystem.blackBoard.getEntry<PIXI.Container>('sprites'));
        });
        world.getManager<GroupManager>(GroupManager).add(entity, Constants.Groups.PLAYER_SHIP);
        return entity;
    }
}
...

var player = world.createEntityFromTemplate('player', x, y);

cli bolt-on

Entitas style api bolt-on generates component definitions.

World.prototype.createPlayer = function(x:number, y:number):Entity {
    return this.createEntity("Player")
      .addPosition(x, y)
      .addVelocity(0, 0)
      .addBounds(43)
      .addHealth(100, 100)
      .addLayer(Layer.ACTORS_3)
      .addResource('fighter')
      .setPlayer(true)
      .start(Groups.PLAYER_SHIP);

};
...

var player = world.createPlayer(x, y);

Example at https://github.com/darkoverlordofdata/shmupwarz/tree/artemis

Usage:
  bin/artemis init namespace [-t name]
  bin/artemis create -c name field:type... 
  bin/artemis create -s name superclass component...
  bin/artemis create -e name 
  bin/artemis create -x class name field:type...
  bin/artemis generate

Options:
  -t  [--template]  # template name
  -c  [--component] # create a component
  -s  [--system]    # create a system
  -e  [--entity]    # create an entity
  -x  [--extension] # extend a class

MIT License

Copyright (c) 2015-2016 Bruce Davidson <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

artemists's People

Contributors

darkoverlordofdata avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.