a_maze_ing 0.5.3 → 0.5.4
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/images/help.jpg +0 -0
- data/lib/a_maze_ing/game_window.rb +11 -10
- data/lib/a_maze_ing/player.rb +1 -1
- data/lib/a_maze_ing/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea18e1b9eec1221cb36c713893f99ff44cf831e
|
4
|
+
data.tar.gz: 40f936d618109039369390e94855df168f64be10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 265c9c7436b4cded302b5aa41494810b24404bbe0e86410dc4cb44ba429c219f3914d1edba8e3983697f848f00c22591054be4dc188c016d93cfcee8f5334d43
|
7
|
+
data.tar.gz: 70d4e2290dd907d29e96cfffece7ada0616a2da6705b5be003b1281dc81eb665b6258148a7ca307abd276c5b535a01810030eb24efc5acb971385fef5896219e
|
data/images/help.jpg
ADDED
Binary file
|
@@ -23,13 +23,13 @@ module AMazeIng
|
|
23
23
|
|
24
24
|
class GameWindow < Window
|
25
25
|
$rows = $cols = ROWS
|
26
|
+
$target_cell_index_x = TARGET_CELL_INDEX_X
|
27
|
+
$target_cell_index_y = TARGET_CELL_INDEX_Y
|
26
28
|
def initialize(full_screen, game_mode)
|
27
29
|
@game_mode = game_mode
|
28
30
|
super DIMENSION + SIDE_BAR, DIMENSION, full_screen, 30
|
29
31
|
self.caption = "Maze"
|
30
32
|
|
31
|
-
|
32
|
-
|
33
33
|
#---------------------------------------------------------------------------------#
|
34
34
|
# create code block (update, player_draw and new_player) for different game mode #
|
35
35
|
#---------------------------------------------------------------------------------#
|
@@ -100,9 +100,6 @@ module AMazeIng
|
|
100
100
|
@infor = Infor.new(PLAYER_COLOR_PRIMARY, PLAYER_COLOR_ANGRY)
|
101
101
|
end
|
102
102
|
|
103
|
-
@target_x = (TARGET_CELL_INDEX_X * $cell_size) + $cell_size/2 - $player_size/2
|
104
|
-
@target_y = (TARGET_CELL_INDEX_Y * $cell_size) + $cell_size/2 - $player_size/2
|
105
|
-
|
106
103
|
end # End initialize function
|
107
104
|
|
108
105
|
|
@@ -111,10 +108,14 @@ module AMazeIng
|
|
111
108
|
$cols += 2
|
112
109
|
@maze = Maze.new
|
113
110
|
@maze.generate_maze
|
114
|
-
@new_player_lambda.call
|
111
|
+
@new_player_lambda.call
|
112
|
+
$target_cell_index_x += 2
|
113
|
+
$target_cell_index_y += 2
|
114
|
+
@target_x = ($target_cell_index_x * $cell_size) + $cell_size/2 - $player_size/2
|
115
|
+
@target_y = ($target_cell_index_y * $cell_size) + $cell_size/2 - $player_size/2
|
115
116
|
end
|
116
117
|
|
117
|
-
def draw_target
|
118
|
+
def draw_target
|
118
119
|
draw_quad @target_x, @target_y, Color::WHITE,
|
119
120
|
@target_x + $player_size, @target_y, Color::WHITE,
|
120
121
|
@target_x + $player_size, @target_y + $player_size, Color::WHITE,
|
@@ -122,7 +123,7 @@ module AMazeIng
|
|
122
123
|
end
|
123
124
|
|
124
125
|
def check_for_finish(player)
|
125
|
-
if player.
|
126
|
+
if player.x == @target_x and player.y == @target_y
|
126
127
|
new_round
|
127
128
|
@infor.level += 1
|
128
129
|
return true
|
@@ -132,7 +133,7 @@ module AMazeIng
|
|
132
133
|
end
|
133
134
|
|
134
135
|
def check_for_collision(player_1, player_2)
|
135
|
-
if player_2.
|
136
|
+
if (player_2.x - player_1.x).abs < $player_size and (player_2.y - player_1.y).abs < $player_size
|
136
137
|
new_round
|
137
138
|
@infor.level += 1
|
138
139
|
return true
|
@@ -156,7 +157,7 @@ module AMazeIng
|
|
156
157
|
end
|
157
158
|
@player_draw_lambda.call
|
158
159
|
@infor.draw
|
159
|
-
draw_target
|
160
|
+
draw_target
|
160
161
|
end
|
161
162
|
|
162
163
|
# check weather the direction player want to go to available or not
|
data/lib/a_maze_ing/player.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module AMazeIng
|
2
2
|
class Player
|
3
|
-
attr_accessor :cell_index_x, :cell_index_y, :target_x, :target_y, :is_moving, :path
|
3
|
+
attr_accessor :cell_index_x, :cell_index_y, :target_x, :target_y, :is_moving, :path, :x, :y
|
4
4
|
def initialize(cell_index_x, cell_index_y, color)
|
5
5
|
@color = color
|
6
6
|
@cell_index_x = cell_index_x
|
data/lib/a_maze_ing/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a_maze_ing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- at-cuongtran
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- bin/setup
|
89
89
|
- images/annoying_friend.jpg
|
90
90
|
- images/classic.jpg
|
91
|
+
- images/help.jpg
|
91
92
|
- images/multiplayer.jpg
|
92
93
|
- lib/a_maze_ing.rb
|
93
94
|
- lib/a_maze_ing/cell.rb
|