Giter Site home page Giter Site logo

transformiumjs's Introduction

TransformiumJS

Version 0.5 Beta 2 - demo http://sourcehint.com/Physics/

Feauters

  1. Modular

  2. Multiple input types:

    a) Keyboard b) Mouse c) Touch d) Joystic is not implemented yet.

  3. GameObjects

    var gameLoop = new GameLoop();
    var player = new GameObject();
    
    gameLoop.on('update', function(delta) {
        player.update(delta);
    });
    
    gameLoop.start();
  1. Physics engine (thanks to MatterJS - http://brm.io/matter-js/)

  2. Storage container system

    //Add commads queue to the player gameObject
    player.commandsQueue = new Container();
  1. Components system
    • Just attach RigidBody and physics engine will automaticly simulate it.
    
    //Create rigid body component as a cube
    var cubeBody = new RigidBody('rectangle', x, y, width, height, options);
    //Attach it to player
    player.components.attach(cubeBody);
  1. Event system
var keyboard = new Keyboard();

//Handle keyboard events
keyboard.is.on(Output.EVENT_NAME, function(event) {
    if(event.which === 'SPACE' && event.state === false) {
        
        //Create a new player command
        var command = {
            name  : 'JUMP',
            state : event.state,
            time  : event.time
        };
        
        //Add command to the queue.
        player.commandsQueue.add(command);
    }
});

player.command = function(command, delta) {
    switch(command.name) {
        case 'JUMP' : {
        
            //Define force
            var force = {x : 0, y : -5 * delta};
            //Apply it
            this.components.get('RigidBody').applyForce(force);
            
            break;
        }
    }
};

player.update = function(delta) {
    
    while(this.commandsQueue.len()) {
        //Get first command from the queue
        var command = this.commandsQueue.first();
        //Process the command
        this.command(command, delta);
        //Remove command from the queue
        this.commandsQueue.remove(command);
    }
    
};
  1. Phonegap and Icenium implementation is on progress.

    • Feautered classes a) Gyroscope events b) Accelerometer events c) Vibration controller and more..
  2. Rendering system is on progress.

transformiumjs's People

Contributors

corsa1r avatar

Stargazers

Michał Piechura avatar 李轶博 avatar Nick Marazzo avatar Apostol Marinov avatar  avatar

Watchers

James Cloos avatar  avatar Apostol Marinov 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.