Bacon2D

Bacon2D

Bacon2D includes useful QML components for creating 2D games with ease. QML simplifies creating native applications in a declarative way. Bacon2D adds essentials for creating appealing games.

Starting with the top-level Game container, which provides a game loop and Scene management, all the way down to entities with Box2D physics and parallax layers with infinite scrolling. You should find Bacon2D gives you everything you need to create a great game.

Resources

Definitions

  • Game: The top-level container, provides the game loop and manages Scene changes. See also Game.
  • Scene: Container of game entities. Performs updates on each Entity in the Scene for each tick of the Game loop. See also Scene.
  • Viewport: The visible portion of a larger Scene. See also Viewport.
  • Behaviors: Provides a means for AI in the game. See also ScriptBehavior.
  • Box2D: Physics engine for simulating rigid bodies in 2D. See also Box2D.
  • Parallax: Infinite scrolling backgrounds with options to mirror images. See also ImageLayer.
  • Entity: The basic game entity, includes physics (Box2D) properties, responds to scene updates and can contain game logic. See also ImageLayer.

Example usage - Basic Scene

import QtQuick 2.2
import Bacon2D 1.0

Game {
    id: game
    width: 400
    height: 250
    currentScene: scene

    Settings {
        id: settings
        property int highScore: 0
        property bool noSound: false
    }

    Scene {
        id: scene
        physics: true
        width: parent.width
        height: parent.height

        Entity {
            width: parent.width
            height: parent.height
            updateInterval: 50
            behavior: ScriptBehavior {
                script: {
                    var newPos = entity.x + 5
                    entity.x = newPos > parent.width ? 0 : newPos
                    console.log("update: x -> ", entity.x)
                }
            }

            Rectangle {
                width: 50
                height: 50
                color: "red"
            }
        }
    }
}
Components

Available through:

    import Bacon2D 1.0
Reporting Bugs

Please file bugs on Github