fantasy 0.1.7 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b920c99d05b572330432388e4cb4bae6ef5b814d8834bb3b05da16375f49bf6
4
- data.tar.gz: 2a5d7c01b7f3e98b5c8928f70981f5bf3591badc844f33a1209f49f6883a426d
3
+ metadata.gz: 0de009c2a3c9785532dd054f8f33cfb67933bb7f136a291638d8d15339919ff4
4
+ data.tar.gz: 194a34e34ccaf055175067efc1cbc122f334abfe290f8e78e24c75c4d742ef8c
5
5
  SHA512:
6
- metadata.gz: b791f6790eaa41e1c0cd49ef9faf514ef1fdacf9310f4dcf6cdfe6aeae2ebde28952d2f748c1e4f155dea6145dbbee7755599bf6a2555479b36a0d0390752bc0
7
- data.tar.gz: e6be40d13c6b7a8c19e0e3604a1554eaa2f2efbc08ea7a9769e9b3db94407a1d8e3fd18c7ea0e08089ff6643e69e9c251d3de746720f464d6313b29baa288a50
6
+ metadata.gz: d9dd083f303373be39e448140f37ef3efa93f307013a111a7e3fde435a1af2f8705e8064a88fd445e1a57613d7983b15ffbcce21aff50f8d04664b33db76b332
7
+ data.tar.gz: 2bd16fd118df26b580f543686c5828be62e7c725490cf20e8fab3f4102701713bda9d59e5b011c5e62e2052fdca80df59f529561e71704e7acb54425aa7790d0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
- ## [Unreleased]
1
+ ## [0.1.11] - 2022-03-26
2
+
3
+ - Better jumping and gravity physics
4
+ - Support Shape.rectangle
5
+ - Support on_click callback on Shapes and Actors
6
+ - Support on_cursor_* callbacks on Shapes and Actors
7
+ - Support Color.palette with 150 colors + transparent
8
+
9
+
10
+ ## [0.1.9] - 2022-03-25
11
+
12
+ - Adding platformer support
13
+ - Jump
14
+ - Gravity
15
+ - Music background support
16
+
17
+
18
+ ## [0.1.7] - 2022-03-17
19
+
20
+ - HudText accepts alignment property. Valid values: 'top-left, top-right, center'
21
+
22
+
23
+ ## [0.1.5] - 2022-03-16
24
+
25
+ - Background color or image
26
+ - Tilemap
27
+ - Camera can be controlled by cursors
28
+ - Background image can be replicable
29
+
2
30
 
3
31
  ## [0.1.0] - 2022-03-11
4
32
 
5
33
  - Initial release
34
+
35
+
36
+ ## [Unreleased]
data/COLOR_PALETTE.md ADDED
@@ -0,0 +1,159 @@
1
+ # Color.palette
2
+
3
+ ```ruby
4
+ Color.palette.orange
5
+ Color.palette.crimson
6
+ Color.palette.transparent
7
+ [...]
8
+ ```
9
+
10
+ - ![orange](https://via.placeholder.com/150x50/ffa500/000000?text=+) orange
11
+ - ![red](https://via.placeholder.com/150x50/ff0000/000000?text=+) red
12
+ - ![orange_red](https://via.placeholder.com/150x50/ff4500/000000?text=+) orange_red
13
+ - ![tomato](https://via.placeholder.com/150x50/ff6347/000000?text=+) tomato
14
+ - ![dark_red](https://via.placeholder.com/150x50/8b0000/000000?text=+) dark_red
15
+ - ![fire_brick](https://via.placeholder.com/150x50/b22222/000000?text=+) fire_brick
16
+ - ![crimson](https://via.placeholder.com/150x50/dc143c/000000?text=+) crimson
17
+ - ![deep_pink](https://via.placeholder.com/150x50/ff1493/000000?text=+) deep_pink
18
+ - ![maroon](https://via.placeholder.com/150x50/b03060/000000?text=+) maroon
19
+ - ![indian_red](https://via.placeholder.com/150x50/cd5c5c/000000?text=+) indian_red
20
+ - ![medium_violet_red](https://via.placeholder.com/150x50/c71585/000000?text=+) medium_violet_red
21
+ - ![violet_red](https://via.placeholder.com/150x50/d02090/000000?text=+) violet_red
22
+ - ![light_coral](https://via.placeholder.com/150x50/f08080/000000?text=+) light_coral
23
+ - ![hot_pink](https://via.placeholder.com/150x50/ff69b4/000000?text=+) hot_pink
24
+ - ![pale_violet_red](https://via.placeholder.com/150x50/db7093/000000?text=+) pale_violet_red
25
+ - ![light_pink](https://via.placeholder.com/150x50/ffb6c1/000000?text=+) light_pink
26
+ - ![rosy_brown](https://via.placeholder.com/150x50/bc8f8f/000000?text=+) rosy_brown
27
+ - ![pink](https://via.placeholder.com/150x50/ffc0cb/000000?text=+) pink
28
+ - ![orchid](https://via.placeholder.com/150x50/da70d6/000000?text=+) orchid
29
+ - ![lavender_blush](https://via.placeholder.com/150x50/fff0f5/000000?text=+) lavender_blush
30
+ - ![snow](https://via.placeholder.com/150x50/fffafa/000000?text=+) snow
31
+ - ![chocolate](https://via.placeholder.com/150x50/d2691e/000000?text=+) chocolate
32
+ - ![saddle_brown](https://via.placeholder.com/150x50/8b4513/000000?text=+) saddle_brown
33
+ - ![brown](https://via.placeholder.com/150x50/843c24/000000?text=+) brown
34
+ - ![dark_orange](https://via.placeholder.com/150x50/ff8c00/000000?text=+) dark_orange
35
+ - ![coral](https://via.placeholder.com/150x50/ff7f50/000000?text=+) coral
36
+ - ![sienna](https://via.placeholder.com/150x50/a0522d/000000?text=+) sienna
37
+ - ![salmon](https://via.placeholder.com/150x50/fa8072/000000?text=+) salmon
38
+ - ![peru](https://via.placeholder.com/150x50/cd853f/000000?text=+) peru
39
+ - ![dark_goldenrod](https://via.placeholder.com/150x50/b8860b/000000?text=+) dark_goldenrod
40
+ - ![goldenrod](https://via.placeholder.com/150x50/daa520/000000?text=+) goldenrod
41
+ - ![sandy_brown](https://via.placeholder.com/150x50/f4a460/000000?text=+) sandy_brown
42
+ - ![light_salmon](https://via.placeholder.com/150x50/ffa07a/000000?text=+) light_salmon
43
+ - ![dark_salmon](https://via.placeholder.com/150x50/e9967a/000000?text=+) dark_salmon
44
+ - ![gold](https://via.placeholder.com/150x50/ffd700/000000?text=+) gold
45
+ - ![yellow](https://via.placeholder.com/150x50/ffff00/000000?text=+) yellow
46
+ - ![olive](https://via.placeholder.com/150x50/808000/000000?text=+) olive
47
+ - ![burlywood](https://via.placeholder.com/150x50/deb887/000000?text=+) burlywood
48
+ - ![tan](https://via.placeholder.com/150x50/d2b48c/000000?text=+) tan
49
+ - ![navajo_white](https://via.placeholder.com/150x50/ffdead/000000?text=+) navajo_white
50
+ - ![peach_puff](https://via.placeholder.com/150x50/ffdab9/000000?text=+) peach_puff
51
+ - ![khaki](https://via.placeholder.com/150x50/f0e68c/000000?text=+) khaki
52
+ - ![dark_khaki](https://via.placeholder.com/150x50/bdb76b/000000?text=+) dark_khaki
53
+ - ![moccasin](https://via.placeholder.com/150x50/ffe4b5/000000?text=+) moccasin
54
+ - ![wheat](https://via.placeholder.com/150x50/f5deb3/000000?text=+) wheat
55
+ - ![bisque](https://via.placeholder.com/150x50/ffe4c4/000000?text=+) bisque
56
+ - ![pale_goldenrod](https://via.placeholder.com/150x50/eee8aa/000000?text=+) pale_goldenrod
57
+ - ![blanched_almond](https://via.placeholder.com/150x50/ffebcd/000000?text=+) blanched_almond
58
+ - ![medium_goldenrod](https://via.placeholder.com/150x50/eaeaad/000000?text=+) medium_goldenrod
59
+ - ![papaya_whip](https://via.placeholder.com/150x50/ffefd5/000000?text=+) papaya_whip
60
+ - ![misty_rose](https://via.placeholder.com/150x50/ffe4e1/000000?text=+) misty_rose
61
+ - ![lemon_chiffon](https://via.placeholder.com/150x50/fffacd/000000?text=+) lemon_chiffon
62
+ - ![antique_white](https://via.placeholder.com/150x50/faebd7/000000?text=+) antique_white
63
+ - ![cornsilk](https://via.placeholder.com/150x50/fff8dc/000000?text=+) cornsilk
64
+ - ![light_goldenrod_yellow](https://via.placeholder.com/150x50/fafad2/000000?text=+) light_goldenrod_yellow
65
+ - ![old_lace](https://via.placeholder.com/150x50/fdf5e6/000000?text=+) old_lace
66
+ - ![linen](https://via.placeholder.com/150x50/faf0e6/000000?text=+) linen
67
+ - ![light_yellow](https://via.placeholder.com/150x50/ffffe0/000000?text=+) light_yellow
68
+ - ![seashell](https://via.placeholder.com/150x50/fff5ee/000000?text=+) seashell
69
+ - ![beige](https://via.placeholder.com/150x50/f5f5dc/000000?text=+) beige
70
+ - ![floral_white](https://via.placeholder.com/150x50/fffaf0/000000?text=+) floral_white
71
+ - ![ivory](https://via.placeholder.com/150x50/fffff0/000000?text=+) ivory
72
+ - ![green](https://via.placeholder.com/150x50/00ff00/000000?text=+) green
73
+ - ![lawn_green](https://via.placeholder.com/150x50/7cfc00/000000?text=+) lawn_green
74
+ - ![chartreuse](https://via.placeholder.com/150x50/7fff00/000000?text=+) chartreuse
75
+ - ![green_yellow](https://via.placeholder.com/150x50/adff2f/000000?text=+) green_yellow
76
+ - ![yellow_green](https://via.placeholder.com/150x50/9acd32/000000?text=+) yellow_green
77
+ - ![medium_forest_green](https://via.placeholder.com/150x50/6b8e23/000000?text=+) medium_forest_green
78
+ - ![olive_drab](https://via.placeholder.com/150x50/6b8e23/000000?text=+) olive_drab
79
+ - ![dark_olive_green](https://via.placeholder.com/150x50/556b2f/000000?text=+) dark_olive_green
80
+ - ![dark_sea_green](https://via.placeholder.com/150x50/8fbc8b/000000?text=+) dark_sea_green
81
+ - ![lime](https://via.placeholder.com/150x50/00ff00/000000?text=+) lime
82
+ - ![dark_green](https://via.placeholder.com/150x50/006400/000000?text=+) dark_green
83
+ - ![lime_green](https://via.placeholder.com/150x50/32cd32/000000?text=+) lime_green
84
+ - ![forest_green](https://via.placeholder.com/150x50/228b22/000000?text=+) forest_green
85
+ - ![spring_green](https://via.placeholder.com/150x50/00ff7f/000000?text=+) spring_green
86
+ - ![medium_spring_green](https://via.placeholder.com/150x50/00fa9a/000000?text=+) medium_spring_green
87
+ - ![sea_green](https://via.placeholder.com/150x50/2e8b57/000000?text=+) sea_green
88
+ - ![medium_sea_green](https://via.placeholder.com/150x50/3cb371/000000?text=+) medium_sea_green
89
+ - ![aquamarine](https://via.placeholder.com/150x50/70d890/000000?text=+) aquamarine
90
+ - ![light_green](https://via.placeholder.com/150x50/90ee90/000000?text=+) light_green
91
+ - ![pale_green](https://via.placeholder.com/150x50/98fb98/000000?text=+) pale_green
92
+ - ![medium_aquamarine](https://via.placeholder.com/150x50/66cdaa/000000?text=+) medium_aquamarine
93
+ - ![turquoise](https://via.placeholder.com/150x50/40e0d0/000000?text=+) turquoise
94
+ - ![light_sea_green](https://via.placeholder.com/150x50/20b2aa/000000?text=+) light_sea_green
95
+ - ![medium_turquoise](https://via.placeholder.com/150x50/48d1cc/000000?text=+) medium_turquoise
96
+ - ![honeydew](https://via.placeholder.com/150x50/f0fff0/000000?text=+) honeydew
97
+ - ![mint_cream](https://via.placeholder.com/150x50/f5fffa/000000?text=+) mint_cream
98
+ - ![royal_blue](https://via.placeholder.com/150x50/4169e1/000000?text=+) royal_blue
99
+ - ![dodger_blue](https://via.placeholder.com/150x50/1e90ff/000000?text=+) dodger_blue
100
+ - ![deep_sky_blue](https://via.placeholder.com/150x50/00bfff/000000?text=+) deep_sky_blue
101
+ - ![cornflower_blue](https://via.placeholder.com/150x50/6495ed/000000?text=+) cornflower_blue
102
+ - ![steel_blue](https://via.placeholder.com/150x50/4682b4/000000?text=+) steel_blue
103
+ - ![light_sky_blue](https://via.placeholder.com/150x50/87cefa/000000?text=+) light_sky_blue
104
+ - ![dark_turquoise](https://via.placeholder.com/150x50/00ced1/000000?text=+) dark_turquoise
105
+ - ![cyan](https://via.placeholder.com/150x50/00ffff/000000?text=+) cyan
106
+ - ![aqua](https://via.placeholder.com/150x50/00ffff/000000?text=+) aqua
107
+ - ![dark_cyan](https://via.placeholder.com/150x50/008b8b/000000?text=+) dark_cyan
108
+ - ![teal](https://via.placeholder.com/150x50/008080/000000?text=+) teal
109
+ - ![sky_blue](https://via.placeholder.com/150x50/87ceeb/000000?text=+) sky_blue
110
+ - ![cadet_blue](https://via.placeholder.com/150x50/5f9ea0/000000?text=+) cadet_blue
111
+ - ![dark_slate_gray](https://via.placeholder.com/150x50/2f4f4f/000000?text=+) dark_slate_gray
112
+ - ![dark_slate_grey](https://via.placeholder.com/150x50/2f4f4f/000000?text=+) dark_slate_grey
113
+ - ![light_slate_gray](https://via.placeholder.com/150x50/778899/000000?text=+) light_slate_gray
114
+ - ![light_slate_grey](https://via.placeholder.com/150x50/778899/000000?text=+) light_slate_grey
115
+ - ![slate_gray](https://via.placeholder.com/150x50/708090/000000?text=+) slate_gray
116
+ - ![slate_grey](https://via.placeholder.com/150x50/708090/000000?text=+) slate_grey
117
+ - ![light_steel_blue](https://via.placeholder.com/150x50/b0c4de/000000?text=+) light_steel_blue
118
+ - ![light_blue](https://via.placeholder.com/150x50/add8e6/000000?text=+) light_blue
119
+ - ![powder_blue](https://via.placeholder.com/150x50/b0e0e6/000000?text=+) powder_blue
120
+ - ![pale_turquoise](https://via.placeholder.com/150x50/afeeee/000000?text=+) pale_turquoise
121
+ - ![light_cyan](https://via.placeholder.com/150x50/e0ffff/000000?text=+) light_cyan
122
+ - ![alice_blue](https://via.placeholder.com/150x50/f0f8ff/000000?text=+) alice_blue
123
+ - ![azure](https://via.placeholder.com/150x50/f0ffff/000000?text=+) azure
124
+ - ![medium_blue](https://via.placeholder.com/150x50/0000cd/000000?text=+) medium_blue
125
+ - ![dark_blue](https://via.placeholder.com/150x50/00008b/000000?text=+) dark_blue
126
+ - ![midnight_blue](https://via.placeholder.com/150x50/191970/000000?text=+) midnight_blue
127
+ - ![navy](https://via.placeholder.com/150x50/24248c/000000?text=+) navy
128
+ - ![blue](https://via.placeholder.com/150x50/0000ff/000000?text=+) blue
129
+ - ![indigo](https://via.placeholder.com/150x50/4b0082/000000?text=+) indigo
130
+ - ![blue_violet](https://via.placeholder.com/150x50/8a2be2/000000?text=+) blue_violet
131
+ - ![medium_slate_blue](https://via.placeholder.com/150x50/7b68ee/000000?text=+) medium_slate_blue
132
+ - ![slate_blue](https://via.placeholder.com/150x50/6a5acd/000000?text=+) slate_blue
133
+ - ![purple](https://via.placeholder.com/150x50/a020f0/000000?text=+) purple
134
+ - ![dark_slate_blue](https://via.placeholder.com/150x50/483d8b/000000?text=+) dark_slate_blue
135
+ - ![dark_violet](https://via.placeholder.com/150x50/9400d3/000000?text=+) dark_violet
136
+ - ![dark_orchid](https://via.placeholder.com/150x50/9932cc/000000?text=+) dark_orchid
137
+ - ![medium_purple](https://via.placeholder.com/150x50/9370db/000000?text=+) medium_purple
138
+ - ![medium_orchid](https://via.placeholder.com/150x50/ba55d3/000000?text=+) medium_orchid
139
+ - ![magenta](https://via.placeholder.com/150x50/ff00ff/000000?text=+) magenta
140
+ - ![fuchsia](https://via.placeholder.com/150x50/ff00ff/000000?text=+) fuchsia
141
+ - ![dark_magenta](https://via.placeholder.com/150x50/8b008b/000000?text=+) dark_magenta
142
+ - ![violet](https://via.placeholder.com/150x50/ee82ee/000000?text=+) violet
143
+ - ![plum](https://via.placeholder.com/150x50/dda0dd/000000?text=+) plum
144
+ - ![lavender](https://via.placeholder.com/150x50/e6e6fa/000000?text=+) lavender
145
+ - ![thistle](https://via.placeholder.com/150x50/d8bfd8/000000?text=+) thistle
146
+ - ![ghost_white](https://via.placeholder.com/150x50/f8f8ff/000000?text=+) ghost_white
147
+ - ![white](https://via.placeholder.com/150x50/ffffff/000000?text=+) white
148
+ - ![white_smoke](https://via.placeholder.com/150x50/f5f5f5/000000?text=+) white_smoke
149
+ - ![gainsboro](https://via.placeholder.com/150x50/dcdcdc/000000?text=+) gainsboro
150
+ - ![light_gray](https://via.placeholder.com/150x50/d3d3d3/000000?text=+) light_gray
151
+ - ![light_grey](https://via.placeholder.com/150x50/d3d3d3/000000?text=+) light_grey
152
+ - ![silver](https://via.placeholder.com/150x50/c0c0c0/000000?text=+) silver
153
+ - ![gray](https://via.placeholder.com/150x50/bebebe/000000?text=+) gray
154
+ - ![grey](https://via.placeholder.com/150x50/bebebe/000000?text=+) grey
155
+ - ![dark_gray](https://via.placeholder.com/150x50/a9a9a9/000000?text=+) dark_gray
156
+ - ![dark_grey](https://via.placeholder.com/150x50/a9a9a9/000000?text=+) dark_grey
157
+ - ![dim_gray](https://via.placeholder.com/150x50/696969/000000?text=+) dim_gray
158
+ - ![dim_grey](https://via.placeholder.com/150x50/696969/000000?text=+) dim_grey
159
+ - ![black](https://via.placeholder.com/150x50/000000/000000?text=+) black
data/README.md CHANGED
@@ -96,7 +96,7 @@ Or install it yourself as:
96
96
 
97
97
  ## Features
98
98
 
99
- ### Game Scene transitions
99
+ ### Game Scenes
100
100
 
101
101
  Easy to configure 3 basic game states:
102
102
 
@@ -116,12 +116,13 @@ Managing game elements which have (optionally) image, movement and collision
116
116
  - Easy to set an `image`
117
117
  - Managing movement through `direction` and `speed`
118
118
  - Built-in movement control through cursors
119
- - Collision detection, OnCollision callback
120
- - Jump (TODO)
121
- - Gravity (TODO)
119
+ - Collision detection, OnCollision callback, Collision matrix
120
+ - Jump
121
+ - Gravity
122
122
  - Animations (TODO)
123
123
  - Possibility to extend Actor class or instantiate it directly for simple characters
124
124
  - Allowing magic instance properties (Like in OpenStruct). So programmer can do `actor.stuff = 1` and it is valid (TODO)
125
+ - Alignment "center" and "top-left" (TODO)
125
126
 
126
127
  ### Clock
127
128
 
@@ -181,9 +182,9 @@ Actors in the game will be rendered in the relative position to this camera.
181
182
  - Allow camera move
182
183
  - Easy to follow one actor
183
184
 
184
- ### Colors palette (TODO)
185
+ ### Colors palette
185
186
 
186
- - Not deal with RGB or anything, just a list of colors (TODO)
187
+ - Not deal with RGB or anything, just a list of colors. See [Color.palette](COLOR_PALETTE.md)
187
188
 
188
189
 
189
190
  ### Pause Game (TODO)
@@ -196,7 +197,9 @@ Move the core functions to the top level hierarchy so I don't need to create a `
196
197
 
197
198
  ### Sound
198
199
 
199
- Direct and easy way to play a sound
200
+ - Direct and easy way to play a sound
201
+ - Direct and easy way to play a background music
202
+
200
203
 
201
204
  ### Background
202
205
 
@@ -206,7 +209,7 @@ Simple way to set up:
206
209
  - Image background
207
210
  - Repeatable image background
208
211
 
209
- ### Data Persistance (TODO)
212
+ ### Data Persistance
210
213
 
211
214
  Simple mechanism to save data in disk. For user preferences, game progress, high scores and others
212
215
 
@@ -233,7 +236,7 @@ Multiple movement animation effects like in [DoTween](http://dotween.demigiant.c
233
236
 
234
237
  ## API
235
238
 
236
- ### Game Scene transitions
239
+ ### Game Scenes
237
240
 
238
241
  Configure your game elements on each Scene:
239
242
 
@@ -302,6 +305,7 @@ player.solid = true
302
305
  player.speed = 200
303
306
  player.layer = 1
304
307
  player.move_with_cursors
308
+ player.collision_with = ["enemy", "bullets"] # default "all"
305
309
 
306
310
  player.on_collision do |other|
307
311
  if other.name == "enemy"
@@ -331,6 +335,7 @@ class Player < Actor
331
335
  @speed = 200
332
336
  @layer = 1
333
337
  @direction = Coordinates.zero
338
+ @collision_with = ["enemy", "bullets"] # default "all"
334
339
  move_with_cursors
335
340
  end
336
341
 
@@ -352,6 +357,25 @@ class Player < Actor
352
357
  end
353
358
  ```
354
359
 
360
+ Actor settings for a platformer:
361
+
362
+ ```ruby
363
+ player = Actor.new("warrior") # ./images/warrior.png
364
+ player.solid = true
365
+ player.jump = 150
366
+ player.gravity = 200
367
+ player.move_with_cursors(left: true, right: true, up: false, down: false, jump: true)
368
+
369
+ player.on_jumping do
370
+ Sound.play("jump")
371
+ player.image = "warrior_jump")
372
+ end
373
+
374
+ player.on_floor do
375
+ player.image = "warrior")
376
+ end
377
+ ```
378
+
355
379
  ### Clock
356
380
 
357
381
  ```ruby
@@ -385,6 +409,21 @@ on_game do
385
409
  end
386
410
  ```
387
411
 
412
+ ### Data Persistance
413
+
414
+ ```ruby
415
+ Disk.data.records = [120_000, 11_000, 678]
416
+ Disk.data.last_level = 3
417
+ Disk.data.sound_volume = 12
418
+ Disk.save # data stored in ./disk/data.json
419
+
420
+ # ... in another session
421
+
422
+ Disk.data.records # => [120_000, 11_000, 678]
423
+ Disk.data.last_level # => 3
424
+ Disk.data.sound_volume # => 12
425
+ ```
426
+
388
427
  ### Camera
389
428
 
390
429
  ```ruby
@@ -398,18 +437,43 @@ end
398
437
 
399
438
  ### Sound
400
439
 
440
+ Plays only once:
441
+
401
442
  ```ruby
402
443
  Sound.play("shoot") # ./sounds/shoot.wav
403
444
  ```
404
445
 
446
+ Plays in loop:
447
+
448
+ ```ruby
449
+ Music.play("music") # ./musics/music.mp3
450
+ Music.volume = 0.5
451
+ Music.stop
452
+ ```
453
+
454
+ ### Tilemap
455
+
456
+ ```ruby
457
+ # ./maps/sky.txt
458
+ # 0 0
459
+ # 0 1
460
+ # 0 0
461
+ # 0 01
462
+
463
+ planet = Actor.new("planet")
464
+ star = Actor.new("star")
465
+ map = Tilemap.new(map_name: "sky", tiles: [planet, star], tile_size: 30)
466
+ map.spawn
467
+ ```
405
468
 
406
469
  ### UI
407
470
 
408
471
  #### HUD Text
409
472
 
410
473
  ```ruby
411
- timer = HudText.new(position: Coordinates.new(20, 10))
474
+ timer = HudText.new(position: Coordinates.new(SCREEN_WIDTH / 2, 10))
412
475
  timer.text = 0
476
+ timer.alignment = "center"
413
477
  timer.size = "big"
414
478
 
415
479
  Clock.new { timer.text += 1 }.repeat(seconds: 1)