summaryrefslogtreecommitdiffhomepage
path: root/docs/search_results.txt
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-07-30 16:45:24 -0500
committerAmir Rajan <[email protected]>2020-07-30 16:58:40 -0500
commiteb8b770e1952af371832f5f31e00dae09d498cf9 (patch)
tree0884e11fedbfa01c7ce9f1e028cb6c43a13d2052 /docs/search_results.txt
parent8d000345a3489988e9e86ee9fda9dcc6c70b7012 (diff)
downloaddragonruby-game-toolkit-contrib-eb8b770e1952af371832f5f31e00dae09d498cf9.tar.gz
dragonruby-game-toolkit-contrib-eb8b770e1952af371832f5f31e00dae09d498cf9.zip
OSS synced with 1.12.
Diffstat (limited to 'docs/search_results.txt')
-rw-r--r--docs/search_results.txt63
1 files changed, 63 insertions, 0 deletions
diff --git a/docs/search_results.txt b/docs/search_results.txt
new file mode 100644
index 0000000..b4c5e12
--- /dev/null
+++ b/docs/search_results.txt
@@ -0,0 +1,63 @@
+* DOCS: ~Numeric#frame_index~
+
+This function is helpful for determining the index of frame-by-frame
+ sprite animation. The numeric value ~self~ represents the moment the
+ animation started.
+
+~frame_index~ takes three additional parameters:
+
+- How many frames exist in the sprite animation.
+- How long to hold each animation for.
+- Whether the animation should repeat.
+
+~frame_index~ will return ~nil~ if the time for the animation is out
+of bounds of the parameter specification.
+
+Example using variables:
+
+#+begin_src ruby
+ def tick args
+ start_looping_at = 0
+ number_of_sprites = 6
+ number_of_frames_to_show_each_sprite = 4
+ does_sprite_loop = true
+
+ sprite_index =
+ start_looping_at.frame_index number_of_sprites,
+ number_of_frames_to_show_each_sprite,
+ does_sprite_loop
+
+ sprite_index ||= 0
+
+ args.outputs.sprites << [
+ 640 - 50,
+ 360 - 50,
+ 100,
+ 100,
+ "sprites/dragon-#{sprite_index}.png"
+ ]
+ end
+#+end_src
+
+Example using named parameters:
+
+#+begin_src ruby
+ start_looping_at = 0
+
+ sprite_index =
+ start_looping_at.frame_index count: 6,
+ hold_for: 4,
+ repeat: true
+
+ sprite_index ||= 0
+
+ args.outputs.sprites << [
+ 640 - 50,
+ 360 - 50,
+ 100,
+ 100,
+ "sprites/dragon-#{sprite_index}.png"
+ ]
+#+end_src
+
+