Skip to content

ovalves/celeste-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 

Repository files navigation

Project status: Working In Progress

MIT License PR's Welcome

About Celeste Engine

Celeste Engine is a simple game engine that allows you to write legible and realiable code for high quality 2D games.

  • Simple game engine
  • User input management system
  • Multiple scenes management system
  • Audio source management system
  • Filesystem management system
  • GLSL Shaders management system

This is a minimal Game Engine based on the Build your own 2d game engine.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • To clone and run this repository you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:

Installing Celeste Engine

To install Celeste Engine, follow these steps:

# Clone this repository
git clone https://github.com/ovalves/celeste-engine.git
# Go into the repository
cd celeste-engine
# Install dependencies
npm install
# Run the app
npm run start

Using Celeste Engine

A basic game made with the Celeste Engine needs just these files:

  • assets/fonts - The game text fonts.
  • assets/scenes - The game scenes
  • assets/scripts - The game object scripts
  • assets/sounds - The game source sounds
  • assets/spritesheet - The game spritesheet images
  • assets/textures - The game object textures

How to Use

Simple Game engine script class

  • constructor(MonoBehaviour) - Setup all assets of the game
  • start() - Called in the creation of the game object
  • draw() - Called once per frame, use this method to draw objects in the scene
  • update() - Called once per frame, use this method to interact with user inputs
class FirstScript {
    /**
     * Setup all assets of the game
     *
     * @param MonoBehaviour
     */
    constructor(MonoBehaviour) {
        this.gameObject1 = null;
        this.kBgClip = "../tests/Game/assets/sounds/BGClip.mp3";
        this.kCue = "../tests/Game/assets/sounds/MyGame_cue.wav";
        this.monoBehaviour = MonoBehaviour;
    }

    /**
     * Called in the creation of the game object
     */
    start() {
        this.gameObject1 = this.monoBehaviour.getGameObject('OBJECT_NAME');
    }

    /**
     * Called once per frame
     */
    draw() {
        // Pssando a camera principal da cena para desenhar o objeto
        this.gameObject1.draw(this.monoBehaviour.getMainCamera().getVPMatrix());
    }

    /**
     * Called once per frame
     */
    update() {
        // Game Logic
    }
}

All scripts inherit from MonoBehaviour

MonoBehaviour has several methods, such as:

- getRenderable() : Renderable
    * setColor(color: Array<number>) : Renderable
    * getColor() : Array<number>
    * createObject(shader : any) : Renderable
    * draw(vpMatrix: Array<number>) : void
    * getTransform() : Transform
        * position()
            * setPosition(xPos: number, yPos: number)
            * getPosition()
            * setXPos(xPos: number)
            * getXPos()
            * incXPosBy(delta: number)
            * getYPos()
            * setYPos(yPos: number)
            * incYPosBy(delta: number)
        * rotation()
            * setRotationInRad(rotationInRadians: number)
            * setRotationInDegree(rotationInDegree: number)
            * incRotationByDegree(deltaDegree: number)
            * incRotationByRad(deltaRad: number)
            * getRotationInRad()
            * getRotationInDegree()

        * scale()
            * setSize(width: number, height: number)
            * getSize()
            * incSizeBy(delta: number)
            * getWidth()
            * setWidth(width: number)
            * incWidthBy(delta: number)
            * getHeight()
            * setHeight(height: number)
            * incHeightBy(delta: number)
* getSimpleShader()
* getTextureShader()
* getGameObject(objectName: string)
* changeScene(sceneName: string)
* getAudio()
* playBackgroundAudio(audioName: string)
* playAudioTrack(audioName: string)
* getMainCamera()
* getCameras()
* getInput()
    * isKeyPressed(keyCode: any)
    * isKeyClicked(keyCode: any)
    * getKey(searchedKey: string)
* key()
* getVector2()
* getVector3()
* getMatrix2()
* getMatrix2D()
* getMatrix3()
* getMatrix4()
* getQuaternion()
* getQuaternion2()

License

The Celeste Engine is licensed under the MIT license. See License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published