gamez 0.0.2+3 gamez: ^0.0.2+3 copied to clipboard
A small 2D game engine to easily create games in Flutter by providing different methods for rendering, gesture detection, etc.
GamEZ #
A small 2D game engine to easily create games in Flutter by providing different methods for rendering, gesture detection, etc.
Utilization #
Create the game model #
The game model is responsible for the logical part of the game, such as adding/removing entities and managing gestures.
class MyGameProvider extends Game {
// ... Implement override methods ...
}
Then you can create a new character MyCharacter
:
class MyCharacter extends GameEntity {
MyCharacter(Vector position, Size size) : super(position, size);
// ... Implement override methods ...
}
To add it to the game you have to call MyGameProvider::entities.add(MyCharacter)
If you want to add an entity without gestures, you can extend it from RenderElement
:
class MyElement extends RenderElement {
MyElement(Vector position, Size size) : super(position, size);
// ... Implement override methods ...
}
Create the game screen #
In order to render and detect gestures you have to create a game screen:
class MyGame extends GameScreen {
MyGame() : super(game: MyGameProvider());
}
You can also add a widget to the game screen by calling MyGame::addChild(MyWidget)
Other resources #
Some useful resources are provided:
Sprite
: Image loader and renderer.FileManager
: Synchronous file Manager.Vector
: 2D vector with various operations.
Example #
You can find here a Flutter game using this engine.
Possible future improvements #
For "completion", some planned features:
- Detection of all gestures.
- More basic components.
- Audio support.
All contributions are warmly welcomed.