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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0de009c2a3c9785532dd054f8f33cfb67933bb7f136a291638d8d15339919ff4
4
- data.tar.gz: 194a34e34ccaf055175067efc1cbc122f334abfe290f8e78e24c75c4d742ef8c
3
+ metadata.gz: 0d18d89b226d845f1a7f3a85ec0eb26efd18ad3d4820e35079b5d93bf2844fad
4
+ data.tar.gz: 60bf1ff81ec6fcec9a4225e0550dc110d6d0686742f4ac6e6611f8f1b7e43158
5
5
  SHA512:
6
- metadata.gz: d9dd083f303373be39e448140f37ef3efa93f307013a111a7e3fde435a1af2f8705e8064a88fd445e1a57613d7983b15ffbcce21aff50f8d04664b33db76b332
7
- data.tar.gz: 2bd16fd118df26b580f543686c5828be62e7c725490cf20e8fab3f4102701713bda9d59e5b011c5e62e2052fdca80df59f529561e71704e7acb54425aa7790d0
6
+ metadata.gz: d2876e85b3def3d90aeb0ad7792a1cc56b6ef8a59c5a967827d5271a6fa13fcd053fa1d2008a2abc7cbd85e477c89ad224a5fac4640abb47ee0447de1d5349bd
7
+ data.tar.gz: 9c39646cebbfc0588b760604c89367022c5feb5c7d2836f1b68aa2c957790d5fce125b97f0ab3a49191234323bbccb3a0d638e6b359c45261f89bf2295e6b7cf
data/.rubocop.yml CHANGED
@@ -10,4 +10,25 @@ Style/StringLiteralsInInterpolation:
10
10
  EnforcedStyle: double_quotes
11
11
 
12
12
  Layout/LineLength:
13
- Max: 120
13
+ Max: 180
14
+
15
+ Style/IfUnlessModifier:
16
+ Enabled: false
17
+
18
+ Naming/MethodParameterName:
19
+ AllowedNames: ["x", "y", "to", "r", "g", "b", "a", "up"]
20
+
21
+ Naming/VariableNumber:
22
+ EnforcedStyle: snake_case
23
+
24
+ Metrics/MethodLength:
25
+ Max: 15
26
+
27
+ Style/AccessorGrouping:
28
+ Enabled: false
29
+
30
+ Metrics/ModuleLength:
31
+ Max: 180
32
+
33
+ Metrics/ClassLength:
34
+ Max: 180
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private - README.md CHANGELOG.md
2
+ --markup markdown
3
+ --markup-provider redcarpet
4
+ --output-dir docs
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.1.13] - 2022-04-01
2
+
3
+ - Data Persistance: Disk module
4
+ - Sound and Music support for volume configuration
5
+
6
+
1
7
  ## [0.1.11] - 2022-03-26
2
8
 
3
9
  - Better jumping and gravity physics
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ ruby ">= 3.0.0"
7
7
  # Specify your gem's dependencies in fantasy.gemspec
8
8
  gemspec
9
9
 
10
- gem "rake", "~> 13.0"
11
10
  gem "minitest", "~> 5.0"
11
+ gem "rake", "~> 13.0"
12
12
  gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fantasy (0.1.13)
5
+ gosu (~> 1.4.1)
6
+ vector2d (~> 2.2.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ contracts (0.9)
13
+ gosu (1.4.3)
14
+ minitest (5.15.0)
15
+ parallel (1.22.1)
16
+ parser (3.1.1.0)
17
+ ast (~> 2.4.1)
18
+ rainbow (3.1.1)
19
+ rake (13.0.6)
20
+ regexp_parser (2.2.1)
21
+ rexml (3.2.5)
22
+ rubocop (1.26.1)
23
+ parallel (~> 1.10)
24
+ parser (>= 3.1.0.0)
25
+ rainbow (>= 2.2.2, < 4.0)
26
+ regexp_parser (>= 1.8, < 3.0)
27
+ rexml
28
+ rubocop-ast (>= 1.16.0, < 2.0)
29
+ ruby-progressbar (~> 1.7)
30
+ unicode-display_width (>= 1.4.0, < 3.0)
31
+ rubocop-ast (1.16.0)
32
+ parser (>= 3.1.1.0)
33
+ ruby-progressbar (1.11.0)
34
+ unicode-display_width (2.1.0)
35
+ vector2d (2.2.3)
36
+ contracts (~> 0.9.0)
37
+ webrick (1.7.0)
38
+ yard (0.9.27)
39
+ webrick (~> 1.7.0)
40
+
41
+ PLATFORMS
42
+ x86_64-darwin-19
43
+
44
+ DEPENDENCIES
45
+ fantasy!
46
+ minitest (~> 5.0)
47
+ rake (~> 13.0)
48
+ rubocop (~> 1.21)
49
+ yard
50
+
51
+ RUBY VERSION
52
+ ruby 3.0.2p107
53
+
54
+ BUNDLED WITH
55
+ 2.2.32
data/README.md CHANGED
@@ -234,6 +234,10 @@ For easy creation of:
234
234
 
235
235
  Multiple movement animation effects like in [DoTween](http://dotween.demigiant.com/documentation.php) (TODO)
236
236
 
237
+ ### Externalized Variables (TODO)
238
+
239
+ Values that can be changed while the game is running. They can be in a Variables file. The game "watch" this file and update the variable in real time.
240
+
237
241
  ## API
238
242
 
239
243
  ### Game Scenes
@@ -314,8 +318,8 @@ player.on_collision do |other|
314
318
  end
315
319
 
316
320
  player.on_after_move do
317
- if player.position.x > SCREEN_WIDTH
318
- player.position.x = SCREEN_WIDTH
321
+ if player.position.x > Global.screen_width
322
+ player.position.x = Global.screen_width
319
323
  end
320
324
 
321
325
  if player.position.x < 0
@@ -339,13 +343,13 @@ class Player < Actor
339
343
  move_with_cursors
340
344
  end
341
345
 
342
- on_collision do |other|
346
+ def on_collision_do(other)
343
347
  if other.name == "enemy"
344
348
  destroy
345
349
  end
346
350
  end
347
351
 
348
- on_after_move do
352
+ def on_after_move_do
349
353
  if @position.x > SCREEN_WIDTH
350
354
  @position.x = SCREEN_WIDTH
351
355
  end
@@ -401,7 +405,7 @@ on_presentation do
401
405
  end
402
406
 
403
407
  # Replicable (by default) Image
404
- # position is relative to Global.camera
408
+ # position is relative to Camera.main
405
409
  on_game do
406
410
  background = Background.new(image_name: "beach")
407
411
  # background.replicable = false # if you don't want the image to replicate
@@ -430,7 +434,7 @@ Disk.data.sound_volume # => 12
430
434
  on_game do
431
435
  on_loop do
432
436
  # Camera follows player
433
- Global.camera.position.y = player.position.y - (SCREEN_HEIGHT / 2)
437
+ Camera.main.position.y = player.position.y - (SCREEN_HEIGHT / 2)
434
438
  end
435
439
  end
436
440
  ```
@@ -501,6 +505,10 @@ Clock.new { icon.visible = !icon.visible }.repeat(seconds: 1)
501
505
  - Tests are missing
502
506
  - Allow Ruby 2.5+
503
507
 
508
+ ## Assets
509
+
510
+ - Images for the test fixtures: https://kenney.nl/
511
+
504
512
  ## Development
505
513
 
506
514
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.