fantasy 0.1.13 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -1
  3. data/.yardopts +4 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +55 -0
  7. data/README.md +14 -6
  8. data/docs/Actor.html +2737 -0
  9. data/docs/Background.html +961 -0
  10. data/docs/Camera.html +791 -0
  11. data/docs/Clock.html +753 -0
  12. data/docs/Color.html +776 -0
  13. data/docs/Coordinates.html +730 -0
  14. data/docs/Cursor.html +752 -0
  15. data/docs/Disk.html +236 -0
  16. data/docs/Draggable.html +198 -0
  17. data/docs/Fantasy.html +121 -0
  18. data/docs/Game.html +904 -0
  19. data/docs/Global.html +2791 -0
  20. data/docs/Gravitier.html +179 -0
  21. data/docs/HudImage.html +979 -0
  22. data/docs/HudText.html +1151 -0
  23. data/docs/Image.html +506 -0
  24. data/docs/Jumper.html +189 -0
  25. data/docs/Mouse.html +226 -0
  26. data/docs/MoveByCursor.html +374 -0
  27. data/docs/MoveByDirection.html +179 -0
  28. data/docs/Mover.html +305 -0
  29. data/docs/Music.html +524 -0
  30. data/docs/Shape.html +1057 -0
  31. data/docs/Sound.html +374 -0
  32. data/docs/Tilemap.html +491 -0
  33. data/docs/Tween.html +186 -0
  34. data/docs/UserInputs.html +879 -0
  35. data/docs/Utils.html +345 -0
  36. data/docs/_index.html +346 -0
  37. data/docs/class_list.html +51 -0
  38. data/docs/css/common.css +1 -0
  39. data/docs/css/full_list.css +58 -0
  40. data/docs/css/style.css +497 -0
  41. data/docs/file.CHANGELOG.html +121 -0
  42. data/docs/file.README.html +599 -0
  43. data/docs/file_list.html +61 -0
  44. data/docs/frames.html +17 -0
  45. data/docs/index.html +599 -0
  46. data/docs/js/app.js +314 -0
  47. data/docs/js/full_list.js +216 -0
  48. data/docs/js/jquery.js +4 -0
  49. data/docs/method_list.html +1931 -0
  50. data/docs/top-level-namespace.html +978 -0
  51. data/lib/fantasy/actor.rb +455 -123
  52. data/lib/fantasy/background.rb +109 -13
  53. data/lib/fantasy/base.rb +113 -1
  54. data/lib/fantasy/camera.rb +95 -11
  55. data/lib/fantasy/clock.rb +4 -2
  56. data/lib/fantasy/color.rb +158 -153
  57. data/lib/fantasy/coordinates.rb +5 -9
  58. data/lib/fantasy/cursor.rb +2 -1
  59. data/lib/fantasy/disk.rb +12 -8
  60. data/lib/fantasy/draggable.rb +22 -1
  61. data/lib/fantasy/global.rb +59 -31
  62. data/lib/fantasy/hud_image.rb +5 -3
  63. data/lib/fantasy/hud_text.rb +6 -2
  64. data/lib/fantasy/image.rb +12 -4
  65. data/lib/fantasy/includes/gravitier.rb +2 -0
  66. data/lib/fantasy/includes/jumper.rb +3 -2
  67. data/lib/fantasy/includes/log.rb +12 -0
  68. data/lib/fantasy/includes/move_by_cursors.rb +24 -15
  69. data/lib/fantasy/includes/move_by_direction.rb +2 -0
  70. data/lib/fantasy/includes/mover.rb +3 -0
  71. data/lib/fantasy/includes/user_inputs.rb +6 -0
  72. data/lib/fantasy/loop.rb +41 -44
  73. data/lib/fantasy/mouse.rb +2 -0
  74. data/lib/fantasy/music.rb +4 -2
  75. data/lib/fantasy/shape.rb +11 -2
  76. data/lib/fantasy/sound.rb +3 -1
  77. data/lib/fantasy/tilemap.rb +19 -13
  78. data/lib/fantasy/tween.rb +3 -1
  79. data/lib/fantasy/utils.rb +7 -13
  80. data/lib/fantasy/version.rb +1 -1
  81. data/lib/fantasy.rb +2 -0
  82. metadata +90 -4
  83. data/fantasy.gemspec +0 -40
  84. data/fonts/VT323-Regular.ttf +0 -0
data/docs/Tilemap.html ADDED
@@ -0,0 +1,491 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Tilemap
8
+
9
+ &mdash; Documentation by YARD 0.9.27
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Tilemap";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (T)</a> &raquo;
40
+
41
+
42
+ <span class="title">Tilemap</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Tilemap
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Tilemap</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/fantasy/tilemap.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
107
+ <ul class="summary">
108
+
109
+ <li class="public ">
110
+ <span class="summary_signature">
111
+
112
+ <a href="#position-instance_method" title="#position (instance method)">#<strong>position</strong> &#x21d2; Object </a>
113
+
114
+
115
+
116
+ </span>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute position.</p>
130
+ </div></span>
131
+
132
+ </li>
133
+
134
+
135
+ </ul>
136
+
137
+
138
+
139
+
140
+
141
+ <h2>
142
+ Instance Method Summary
143
+ <small><a href="#" class="summary_toggle">collapse</a></small>
144
+ </h2>
145
+
146
+ <ul class="summary">
147
+
148
+ <li class="public ">
149
+ <span class="summary_signature">
150
+
151
+ <a href="#height-instance_method" title="#height (instance method)">#<strong>height</strong> &#x21d2; Object </a>
152
+
153
+
154
+
155
+ </span>
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc"><div class='inline'></div></span>
166
+
167
+ </li>
168
+
169
+
170
+ <li class="public ">
171
+ <span class="summary_signature">
172
+
173
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(map_name:, tiles:, tile_size: nil, tile_width: nil, tile_height: nil) &#x21d2; Tilemap </a>
174
+
175
+
176
+
177
+ </span>
178
+
179
+
180
+ <span class="note title constructor">constructor</span>
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc"><div class='inline'><p>A new instance of Tilemap.</p>
190
+ </div></span>
191
+
192
+ </li>
193
+
194
+
195
+ <li class="public ">
196
+ <span class="summary_signature">
197
+
198
+ <a href="#spawn-instance_method" title="#spawn (instance method)">#<strong>spawn</strong> &#x21d2; Object </a>
199
+
200
+
201
+
202
+ </span>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+ <span class="summary_desc"><div class='inline'></div></span>
213
+
214
+ </li>
215
+
216
+
217
+ <li class="public ">
218
+ <span class="summary_signature">
219
+
220
+ <a href="#width-instance_method" title="#width (instance method)">#<strong>width</strong> &#x21d2; Object </a>
221
+
222
+
223
+
224
+ </span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'></div></span>
235
+
236
+ </li>
237
+
238
+
239
+ </ul>
240
+
241
+
242
+ <div id="constructor_details" class="method_details_list">
243
+ <h2>Constructor Details</h2>
244
+
245
+ <div class="method_details first">
246
+ <h3 class="signature first" id="initialize-instance_method">
247
+
248
+ #<strong>initialize</strong>(map_name:, tiles:, tile_size: nil, tile_width: nil, tile_height: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Tilemap (class)">Tilemap</a></span></tt>
249
+
250
+
251
+
252
+
253
+
254
+ </h3><div class="docstring">
255
+ <div class="discussion">
256
+ <p>Returns a new instance of Tilemap.</p>
257
+
258
+
259
+ </div>
260
+ </div>
261
+ <div class="tags">
262
+
263
+
264
+ </div><table class="source_code">
265
+ <tr>
266
+ <td>
267
+ <pre class="lines">
268
+
269
+
270
+ 6
271
+ 7
272
+ 8
273
+ 9
274
+ 10
275
+ 11
276
+ 12
277
+ 13
278
+ 14
279
+ 15
280
+ 16
281
+ 17
282
+ 18
283
+ 19</pre>
284
+ </td>
285
+ <td>
286
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tilemap.rb', line 6</span>
287
+
288
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>map_name:</span><span class='comma'>,</span> <span class='label'>tiles:</span><span class='comma'>,</span> <span class='label'>tile_size:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>tile_width:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>tile_height:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
289
+ <span class='ivar'>@tile_width</span> <span class='op'>=</span> <span class='id identifier rubyid_tile_width'>tile_width</span> <span class='op'>||</span> <span class='id identifier rubyid_tile_size'>tile_size</span>
290
+ <span class='ivar'>@tile_height</span> <span class='op'>=</span> <span class='id identifier rubyid_tile_height'>tile_height</span> <span class='op'>||</span> <span class='id identifier rubyid_tile_size'>tile_size</span>
291
+
292
+ <span class='kw'>if</span> <span class='ivar'>@tile_height</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='ivar'>@tile_width</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
293
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Tile size is not properly defined. Either you set a `tile_size` or a `tile_width` and `tile_height`</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
294
+ <span class='kw'>end</span>
295
+
296
+ <span class='ivar'>@map_name</span> <span class='op'>=</span> <span class='id identifier rubyid_map_name'>map_name</span>
297
+ <span class='ivar'>@tiles</span> <span class='op'>=</span> <span class='id identifier rubyid_tiles'>tiles</span>
298
+ <span class='ivar'>@position</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Coordinates.html" title="Coordinates (class)">Coordinates</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="Coordinates.html#zero-class_method" title="Coordinates.zero (method)">zero</a></span></span>
299
+
300
+ <span class='ivar'>@grid</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Tilemap (class)">Tilemap</a></span></span><span class='period'>.</span><span class='id identifier rubyid_load_grid'>load_grid</span><span class='lparen'>(</span><span class='ivar'>@map_name</span><span class='rparen'>)</span>
301
+ <span class='kw'>end</span></pre>
302
+ </td>
303
+ </tr>
304
+ </table>
305
+ </div>
306
+
307
+ </div>
308
+
309
+ <div id="instance_attr_details" class="attr_details">
310
+ <h2>Instance Attribute Details</h2>
311
+
312
+
313
+ <span id="position=-instance_method"></span>
314
+ <div class="method_details first">
315
+ <h3 class="signature first" id="position-instance_method">
316
+
317
+ #<strong>position</strong> &#x21d2; <tt>Object</tt>
318
+
319
+
320
+
321
+
322
+
323
+ </h3><div class="docstring">
324
+ <div class="discussion">
325
+ <p>Returns the value of attribute position.</p>
326
+
327
+
328
+ </div>
329
+ </div>
330
+ <div class="tags">
331
+
332
+
333
+ </div><table class="source_code">
334
+ <tr>
335
+ <td>
336
+ <pre class="lines">
337
+
338
+
339
+ 4
340
+ 5
341
+ 6</pre>
342
+ </td>
343
+ <td>
344
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tilemap.rb', line 4</span>
345
+
346
+ <span class='kw'>def</span> <span class='id identifier rubyid_position'>position</span>
347
+ <span class='ivar'>@position</span>
348
+ <span class='kw'>end</span></pre>
349
+ </td>
350
+ </tr>
351
+ </table>
352
+ </div>
353
+
354
+ </div>
355
+
356
+
357
+ <div id="instance_method_details" class="method_details_list">
358
+ <h2>Instance Method Details</h2>
359
+
360
+
361
+ <div class="method_details first">
362
+ <h3 class="signature first" id="height-instance_method">
363
+
364
+ #<strong>height</strong> &#x21d2; <tt>Object</tt>
365
+
366
+
367
+
368
+
369
+
370
+ </h3><table class="source_code">
371
+ <tr>
372
+ <td>
373
+ <pre class="lines">
374
+
375
+
376
+ 25
377
+ 26
378
+ 27</pre>
379
+ </td>
380
+ <td>
381
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tilemap.rb', line 25</span>
382
+
383
+ <span class='kw'>def</span> <span class='id identifier rubyid_height'>height</span>
384
+ <span class='ivar'>@grid</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>*</span> <span class='ivar'>@tile_height</span>
385
+ <span class='kw'>end</span></pre>
386
+ </td>
387
+ </tr>
388
+ </table>
389
+ </div>
390
+
391
+ <div class="method_details ">
392
+ <h3 class="signature " id="spawn-instance_method">
393
+
394
+ #<strong>spawn</strong> &#x21d2; <tt>Object</tt>
395
+
396
+
397
+
398
+
399
+
400
+ </h3><table class="source_code">
401
+ <tr>
402
+ <td>
403
+ <pre class="lines">
404
+
405
+
406
+ 29
407
+ 30
408
+ 31
409
+ 32
410
+ 33
411
+ 34
412
+ 35
413
+ 36
414
+ 37
415
+ 38
416
+ 39
417
+ 40
418
+ 41
419
+ 42
420
+ 43
421
+ 44
422
+ 45</pre>
423
+ </td>
424
+ <td>
425
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tilemap.rb', line 29</span>
426
+
427
+ <span class='kw'>def</span> <span class='id identifier rubyid_spawn'>spawn</span>
428
+ <span class='id identifier rubyid_tile_position'>tile_position</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Coordinates.html" title="Coordinates (class)">Coordinates</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="Coordinates.html#zero-class_method" title="Coordinates.zero (method)">zero</a></span></span>
429
+
430
+ <span class='ivar'>@grid</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
431
+ <span class='id identifier rubyid_tile_position'>tile_position</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='int'>0</span>
432
+
433
+ <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tile_index'>tile_index</span><span class='op'>|</span>
434
+ <span class='kw'>unless</span> <span class='id identifier rubyid_tile_index'>tile_index</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
435
+ <span class='id identifier rubyid_render_tile'>render_tile</span><span class='lparen'>(</span><span class='id identifier rubyid_tile_index'>tile_index</span><span class='comma'>,</span> <span class='id identifier rubyid_tile_position'>tile_position</span><span class='rparen'>)</span>
436
+ <span class='kw'>end</span>
437
+
438
+ <span class='id identifier rubyid_tile_position'>tile_position</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span> <span class='op'>+=</span> <span class='int'>1</span>
439
+ <span class='kw'>end</span>
440
+
441
+ <span class='id identifier rubyid_tile_position'>tile_position</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span> <span class='op'>+=</span> <span class='int'>1</span>
442
+ <span class='kw'>end</span>
443
+ <span class='kw'>end</span></pre>
444
+ </td>
445
+ </tr>
446
+ </table>
447
+ </div>
448
+
449
+ <div class="method_details ">
450
+ <h3 class="signature " id="width-instance_method">
451
+
452
+ #<strong>width</strong> &#x21d2; <tt>Object</tt>
453
+
454
+
455
+
456
+
457
+
458
+ </h3><table class="source_code">
459
+ <tr>
460
+ <td>
461
+ <pre class="lines">
462
+
463
+
464
+ 21
465
+ 22
466
+ 23</pre>
467
+ </td>
468
+ <td>
469
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tilemap.rb', line 21</span>
470
+
471
+ <span class='kw'>def</span> <span class='id identifier rubyid_width'>width</span>
472
+ <span class='ivar'>@grid</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:length</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='ivar'>@tile_width</span>
473
+ <span class='kw'>end</span></pre>
474
+ </td>
475
+ </tr>
476
+ </table>
477
+ </div>
478
+
479
+ </div>
480
+
481
+ </div>
482
+
483
+ <div id="footer">
484
+ Generated on Sat Apr 2 14:24:12 2022 by
485
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
486
+ 0.9.27 (ruby-3.0.2).
487
+ </div>
488
+
489
+ </div>
490
+ </body>
491
+ </html>
data/docs/Tween.html ADDED
@@ -0,0 +1,186 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Tween
8
+
9
+ &mdash; Documentation by YARD 0.9.27
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Tween";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (T)</a> &raquo;
40
+
41
+
42
+ <span class="title">Tween</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Tween
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/fantasy/tween.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <h2>
95
+ Class Method Summary
96
+ <small><a href="#" class="summary_toggle">collapse</a></small>
97
+ </h2>
98
+
99
+ <ul class="summary">
100
+
101
+ <li class="public ">
102
+ <span class="summary_signature">
103
+
104
+ <a href="#move_towards-class_method" title="move_towards (class method)">.<strong>move_towards</strong>(from:, to:, speed:) &#x21d2; Object </a>
105
+
106
+
107
+
108
+ </span>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc"><div class='inline'></div></span>
119
+
120
+ </li>
121
+
122
+
123
+ </ul>
124
+
125
+
126
+
127
+
128
+ <div id="class_method_details" class="method_details_list">
129
+ <h2>Class Method Details</h2>
130
+
131
+
132
+ <div class="method_details first">
133
+ <h3 class="signature first" id="move_towards-class_method">
134
+
135
+ .<strong>move_towards</strong>(from:, to:, speed:) &#x21d2; <tt>Object</tt>
136
+
137
+
138
+
139
+
140
+
141
+ </h3><table class="source_code">
142
+ <tr>
143
+ <td>
144
+ <pre class="lines">
145
+
146
+
147
+ 4
148
+ 5
149
+ 6
150
+ 7
151
+ 8
152
+ 9
153
+ 10
154
+ 11
155
+ 12</pre>
156
+ </td>
157
+ <td>
158
+ <pre class="code"><span class="info file"># File 'lib/fantasy/tween.rb', line 4</span>
159
+
160
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_move_towards'>move_towards</span><span class='lparen'>(</span><span class='label'>from:</span><span class='comma'>,</span> <span class='label'>to:</span><span class='comma'>,</span> <span class='label'>speed:</span><span class='rparen'>)</span>
161
+ <span class='id identifier rubyid_direction'>direction</span> <span class='op'>=</span> <span class='id identifier rubyid_to'>to</span> <span class='op'>-</span> <span class='id identifier rubyid_from'>from</span>
162
+ <span class='id identifier rubyid_step'>step</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_direction'>direction</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='comma'>,</span> <span class='id identifier rubyid_speed'>speed</span> <span class='op'>*</span> <span class='const'><span class='object_link'><a href="Global.html" title="Global (module)">Global</a></span></span><span class='period'>.</span><span class='id identifier rubyid_frame_time'><span class='object_link'><a href="Global.html#frame_time-class_method" title="Global.frame_time (method)">frame_time</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
163
+
164
+ <span class='kw'>return</span> <span class='id identifier rubyid_to'>to</span> <span class='kw'>if</span> <span class='id identifier rubyid_step'>step</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
165
+
166
+ <span class='id identifier rubyid_direction'>direction</span> <span class='op'>=</span> <span class='id identifier rubyid_direction'>direction</span><span class='period'>.</span><span class='id identifier rubyid_normalize'>normalize</span>
167
+ <span class='id identifier rubyid_from'>from</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_direction'>direction</span> <span class='op'>*</span> <span class='id identifier rubyid_step'>step</span><span class='rparen'>)</span>
168
+ <span class='kw'>end</span></pre>
169
+ </td>
170
+ </tr>
171
+ </table>
172
+ </div>
173
+
174
+ </div>
175
+
176
+ </div>
177
+
178
+ <div id="footer">
179
+ Generated on Sat Apr 2 14:24:12 2022 by
180
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
+ 0.9.27 (ruby-3.0.2).
182
+ </div>
183
+
184
+ </div>
185
+ </body>
186
+ </html>