Skip to content

Latest commit

 

History

History
98 lines (68 loc) · 2.92 KB

objects.md

File metadata and controls

98 lines (68 loc) · 2.92 KB

Objects

All objects in Bonfire are GameComponent, it is the basis of everything.

This section is intended to list some Objects already implemented and that can be reused to meet a similar need.

They are:

SpriteObject

This is a GameComponent

Object that renders a Sprite.

AnimatedObject

This is a GameComponent

Object that renders a SpriteAnimation.

AnimatedObjectOnce

This is a AnimatedObject

To run an animation once before it destroys itself

AnimatedObjectOnce(
   {
      required Vector2 position,
      required Vector2 size,
      Future<SpriteAnimation>? animation,
      VoidCallback? onFinish,
      VoidCallback? onStartAnimation,
      double? rotateRadAngle,
      LightingConfig? lightingConfig,
   }
)

FollowerObject

This is a GameComponent

Like the previous one, this can play an animation once before it destroys itself and can also can can keep playing in a loop. But the most important feature is that this component follows another element on the map, like a player, enemy or decoration.

AnimatedFollowerObject(
   {
      required Future<SpriteAnimation> animation,
      required GameComponent target,
      required Vector2 size,
      Vector2? positionFromTarget,
      bool loopAnimation = false,
   }
)

AnimatedFollowerObject

This is a FollowerObject

The same FollowerObject with animation.

FlyingAttackObject

This is a FollowerObject and it uses ObjectCollision, Lighting

A component that is in a certain direction set at a certain speed also configurable and only to hit an enemy or player inflicting damage, or it can be destroyed when hitting a component that has a collision (Tiles, Decorations).

FlyingAttackObject(
   {
      required Vector2 position,
      required Future<SpriteAnimation> flyAnimation,
      required this.direction,
      required Vector2 size,
      dynamic id,
      Future<SpriteAnimation>? destroyAnimation,
      double speed = 150,
      double damage = 1,
      AttackFromEnum attackFrom = AttackFromEnum.ENEMY,
      bool withDecorationCollision = true,
      VoidCallback? onDestroyedObject,
      LightingConfig? lightingConfig,
      CollisionConfig? collision,
  }
)

FlyingAttackAngleObject

This is a FollowerObject and use ObjectCollision, Lighting

The same FlyingAttackObject with movement by angle.