GithubHelp home page GithubHelp logo

actionsystem's Introduction

ActionSystem

An inheritance based action system for libGDX.


Sonatype Nexus (Releases) Sonatype Nexus (Snapshots)

How to add to project

To use in your project add the following repositories in your build.gradle. Then this project as a dependency with a specified version.

repositories {
    maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
    maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
}
dependency {
    implementation 'com.vabrantgames.actionsystem:actionsystem:version'
}

Usage

1. Implement Interface

Any class that is to be actioned should implement at least one interface to add functionality.

public class Square implements Movable {
    
    private float x;
    private float y;
    
    @Override
    public void setX(float x) {
        this.x = x;
    }
    
    @Override
    public void setY(float y) {
        this.y = y;
    }
    
    @Override
    public float getX() {
        return x;
    }
    
    @Override
    public float getY() {
        return y;
    }
}

Note: Depending on which interfaces are implemented determines what actions can be used. A class that only implements Movable can not be used for actions that reply on Colorable.

2. Create ActionManager

Create an ActionManager in a top level class like your screen or main game class.

ActionManager actionManager = new ActionManager();

Then in your render method or wherever you update your objects, update the ActionManager by passing in the delta time. actionManager.update(delta);

Note: You can get the delta at Gdx.graphics.getDeltaTime();

3. Create An Action

Actions can easily be created from static helpers located in the action you are trying to use.

MoveAction action = MoveAction.moxeXBy(square, amount, duration, interpolation);

4. Add Action To ActionManager

actionManager.add(action);


Actions

actionsystem's People

Contributors

vabrantgames avatar johnbartondev avatar

Stargazers

Simon Antonio avatar  avatar matejc 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.