gamez 0.0.3+1 copy "gamez: ^0.0.3+1" to clipboard
gamez: ^0.0.3+1 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 game engine for 2D games in Flutter.

Pub release GitHub top language GitHub issues Pawns Game License

Installation #

gamez: ^0.0.3+1

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 ...
}

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 ...
}

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

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());
}

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.

5
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A small 2D game engine to easily create games in Flutter by providing different methods for rendering, gesture detection, etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, path_provider, provider

More

Packages that depend on gamez