Last updated:
0 purchases
gamez
gamEZ #
A small game engine for 2D games in Flutter.
Installation #
gamez: ^0.0.3+1
copied to clipboard
Game creation #
The purpose of this engine is to separate the logical and view/widget parts to give you the freedom to customize them as you wish.
Model creation #
First, we have to create a game model which is responsible for the logical part of the game, such as adding/removing entities, managing gestures, etc.
class MyGame extends Game {
// ... Implement override methods ...
}
copied to clipboard
Then, we create a new character to our game by extending GameEntity
class MyCharacter extends GameEntity {
MyCharacter(Vector position, Size size) : super(position, size);
// ... Implement override methods ...
}
copied to clipboard
This new entity, can be added to the game using Game::addEntity(MyCharacter)
In order to detect gestures use GameEntity::handleGesture(position, gesture), where gesture can be one of the following:
Gesture.tapDown
Gesture.doubleTapDown
Gesture.longPressMoveUpdate
Gesture.longPressStart
Gesture.longPressEnd
copied to clipboard
View creation #
Second, we have to create a widget that extends from GameWidget, then add your model to it.
class MyGameWidget extends GameWidget {
MyGameWidget() : super(game: MyGame());
}
copied to clipboard
You can also add another widget to your game widget by calling GameWidget::addChild(MyWidget)
Concrete example #
You can give a look at Pawns game, a 2D game, that uses this game engine.
Features #
✅ Image renderer
❌ Audio support
❌ Animations support
❌ Tests
Contributions #
All contributions are warmly welcomed.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.