diff options
| author | Owen Butler <[email protected]> | 2021-09-19 21:57:27 +1000 |
|---|---|---|
| committer | Amir Rajan <[email protected]> | 2021-10-11 18:18:43 -0500 |
| commit | 15b361f6a93763f96bd3363c23a5dd4db8160cb2 (patch) | |
| tree | 7a3bac509f3ad81ca5aaf65a79180d344b9e0be3 /docs/todo/05-sprites.md | |
| parent | 2f5eb6ab368b062dbbde39b3cee6eae23c5452ff (diff) | |
| download | dragonruby-game-toolkit-contrib-15b361f6a93763f96bd3363c23a5dd4db8160cb2.tar.gz dragonruby-game-toolkit-contrib-15b361f6a93763f96bd3363c23a5dd4db8160cb2.zip | |
docs: Update sprite class example with attr_sprite
Diffstat (limited to 'docs/todo/05-sprites.md')
| -rw-r--r-- | docs/todo/05-sprites.md | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/docs/todo/05-sprites.md b/docs/todo/05-sprites.md index e8030ab..e2be250 100644 --- a/docs/todo/05-sprites.md +++ b/docs/todo/05-sprites.md @@ -179,26 +179,14 @@ args.outputs.sprites << { ## Duck Typing (Advanced) -You can also create a class with sprite properties and render it as a primitive. -ALL properties must on the class. ADDITIONALLY, a method called `primitive_marker` -must be defined on the class. +You can also create a class with sprite properties and render it as a primitive, +using the `attr_sprite` helper. Here is an example: ```ruby -# Create type with ALL sprite properties AND primitive_marker -class Sprite - attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :source_x, - :source_y, :source_w, :source_h, :flip_horizontally, - :flip_vertically, :angle_anchor_x, :angle_anchor_y - - def primitive_marker - :sprite - end -end - -# Inherit from type -class PlayerSprite < Sprite +class PlayerSprite + attr_sprite # constructor def initialize x, y, w, h |
