fantasy 0.1.11 → 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +22 -1
- data/.yardopts +4 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +55 -0
- data/README.md +36 -13
- data/docs/Actor.html +2737 -0
- data/docs/Background.html +961 -0
- data/docs/Camera.html +791 -0
- data/docs/Clock.html +753 -0
- data/docs/Color.html +776 -0
- data/docs/Coordinates.html +730 -0
- data/docs/Cursor.html +752 -0
- data/docs/Disk.html +236 -0
- data/docs/Draggable.html +198 -0
- data/docs/Fantasy.html +121 -0
- data/docs/Game.html +904 -0
- data/docs/Global.html +2791 -0
- data/docs/Gravitier.html +179 -0
- data/docs/HudImage.html +979 -0
- data/docs/HudText.html +1151 -0
- data/docs/Image.html +506 -0
- data/docs/Jumper.html +189 -0
- data/docs/Mouse.html +226 -0
- data/docs/MoveByCursor.html +374 -0
- data/docs/MoveByDirection.html +179 -0
- data/docs/Mover.html +305 -0
- data/docs/Music.html +524 -0
- data/docs/Shape.html +1057 -0
- data/docs/Sound.html +374 -0
- data/docs/Tilemap.html +491 -0
- data/docs/Tween.html +186 -0
- data/docs/UserInputs.html +879 -0
- data/docs/Utils.html +345 -0
- data/docs/_index.html +346 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.CHANGELOG.html +121 -0
- data/docs/file.README.html +599 -0
- data/docs/file_list.html +61 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +599 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1931 -0
- data/docs/top-level-namespace.html +978 -0
- data/lib/fantasy/actor.rb +455 -112
- data/lib/fantasy/background.rb +109 -13
- data/lib/fantasy/base.rb +113 -1
- data/lib/fantasy/camera.rb +95 -11
- data/lib/fantasy/clock.rb +4 -2
- data/lib/fantasy/color.rb +158 -153
- data/lib/fantasy/coordinates.rb +5 -9
- data/lib/fantasy/cursor.rb +22 -0
- data/lib/fantasy/disk.rb +35 -0
- data/lib/fantasy/draggable.rb +22 -1
- data/lib/fantasy/global.rb +59 -31
- data/lib/fantasy/hud_image.rb +5 -3
- data/lib/fantasy/hud_text.rb +9 -3
- data/lib/fantasy/image.rb +12 -4
- data/lib/fantasy/includes/gravitier.rb +2 -0
- data/lib/fantasy/includes/jumper.rb +3 -2
- data/lib/fantasy/includes/log.rb +12 -0
- data/lib/fantasy/includes/move_by_cursors.rb +24 -15
- data/lib/fantasy/includes/move_by_direction.rb +2 -0
- data/lib/fantasy/includes/mover.rb +7 -0
- data/lib/fantasy/includes/user_inputs.rb +6 -0
- data/lib/fantasy/loop.rb +41 -44
- data/lib/fantasy/mouse.rb +2 -0
- data/lib/fantasy/music.rb +7 -3
- data/lib/fantasy/shape.rb +11 -2
- data/lib/fantasy/sound.rb +5 -3
- data/lib/fantasy/tilemap.rb +19 -13
- data/lib/fantasy/tween.rb +3 -1
- data/lib/fantasy/utils.rb +7 -13
- data/lib/fantasy/version.rb +1 -1
- data/lib/fantasy.rb +3 -0
- metadata +91 -4
- data/fantasy.gemspec +0 -40
- data/fonts/VT323-Regular.ttf +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d18d89b226d845f1a7f3a85ec0eb26efd18ad3d4820e35079b5d93bf2844fad
|
|
4
|
+
data.tar.gz: 60bf1ff81ec6fcec9a4225e0550dc110d6d0686742f4ac6e6611f8f1b7e43158
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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:
|
|
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
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
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
|
@@ -96,7 +96,7 @@ Or install it yourself as:
|
|
|
96
96
|
|
|
97
97
|
## Features
|
|
98
98
|
|
|
99
|
-
### Game
|
|
99
|
+
### Game Scenes
|
|
100
100
|
|
|
101
101
|
Easy to configure 3 basic game states:
|
|
102
102
|
|
|
@@ -209,7 +209,7 @@ Simple way to set up:
|
|
|
209
209
|
- Image background
|
|
210
210
|
- Repeatable image background
|
|
211
211
|
|
|
212
|
-
### Data Persistance
|
|
212
|
+
### Data Persistance
|
|
213
213
|
|
|
214
214
|
Simple mechanism to save data in disk. For user preferences, game progress, high scores and others
|
|
215
215
|
|
|
@@ -234,9 +234,13 @@ 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
|
-
### Game
|
|
243
|
+
### Game Scenes
|
|
240
244
|
|
|
241
245
|
Configure your game elements on each Scene:
|
|
242
246
|
|
|
@@ -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 >
|
|
318
|
-
player.position.x =
|
|
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
|
-
|
|
346
|
+
def on_collision_do(other)
|
|
343
347
|
if other.name == "enemy"
|
|
344
348
|
destroy
|
|
345
349
|
end
|
|
346
350
|
end
|
|
347
351
|
|
|
348
|
-
|
|
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
|
|
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
|
|
@@ -409,13 +413,28 @@ on_game do
|
|
|
409
413
|
end
|
|
410
414
|
```
|
|
411
415
|
|
|
416
|
+
### Data Persistance
|
|
417
|
+
|
|
418
|
+
```ruby
|
|
419
|
+
Disk.data.records = [120_000, 11_000, 678]
|
|
420
|
+
Disk.data.last_level = 3
|
|
421
|
+
Disk.data.sound_volume = 12
|
|
422
|
+
Disk.save # data stored in ./disk/data.json
|
|
423
|
+
|
|
424
|
+
# ... in another session
|
|
425
|
+
|
|
426
|
+
Disk.data.records # => [120_000, 11_000, 678]
|
|
427
|
+
Disk.data.last_level # => 3
|
|
428
|
+
Disk.data.sound_volume # => 12
|
|
429
|
+
```
|
|
430
|
+
|
|
412
431
|
### Camera
|
|
413
432
|
|
|
414
433
|
```ruby
|
|
415
434
|
on_game do
|
|
416
435
|
on_loop do
|
|
417
436
|
# Camera follows player
|
|
418
|
-
|
|
437
|
+
Camera.main.position.y = player.position.y - (SCREEN_HEIGHT / 2)
|
|
419
438
|
end
|
|
420
439
|
end
|
|
421
440
|
```
|
|
@@ -440,10 +459,10 @@ Music.stop
|
|
|
440
459
|
|
|
441
460
|
```ruby
|
|
442
461
|
# ./maps/sky.txt
|
|
443
|
-
#0
|
|
444
|
-
#
|
|
445
|
-
#
|
|
446
|
-
#0
|
|
462
|
+
# 0 0
|
|
463
|
+
# 0 1
|
|
464
|
+
# 0 0
|
|
465
|
+
# 0 01
|
|
447
466
|
|
|
448
467
|
planet = Actor.new("planet")
|
|
449
468
|
star = Actor.new("star")
|
|
@@ -486,6 +505,10 @@ Clock.new { icon.visible = !icon.visible }.repeat(seconds: 1)
|
|
|
486
505
|
- Tests are missing
|
|
487
506
|
- Allow Ruby 2.5+
|
|
488
507
|
|
|
508
|
+
## Assets
|
|
509
|
+
|
|
510
|
+
- Images for the test fixtures: https://kenney.nl/
|
|
511
|
+
|
|
489
512
|
## Development
|
|
490
513
|
|
|
491
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.
|