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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac2d90d1b404af1a23d3c15aa56ba2b43980a053
4
- data.tar.gz: 16c989a33c190aa047ea29d4e3e1a4edac58678d
3
+ metadata.gz: bea18e1b9eec1221cb36c713893f99ff44cf831e
4
+ data.tar.gz: 40f936d618109039369390e94855df168f64be10
5
5
  SHA512:
6
- metadata.gz: 2869dfccd82fe6eb394db5e1b2c80a79d97a35de8263baf0405f0a7fe611383ffc58aa8ae89d84fb3ae7f0b1d85e5a1f0560e968e26d390d648b2aa3d984e880
7
- data.tar.gz: b61f4b49474ef300ea74daeed71aad0eac7ff8a17910cbc2e3c106447e3b1aecfce1aae3c2a5c0c3462197c547756eb570284e3c90651704d1cb22d2d1c7ef89
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(cell)
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.cell_index_x == $cells[-1].cell_index_x and player.cell_index_y == $cells[-1].cell_index_y
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.cell_index_x == player_1.cell_index_x and player_2.cell_index_y == player_1.cell_index_y
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($cells[-1])
160
+ draw_target
160
161
  end
161
162
 
162
163
  # check weather the direction player want to go to available or not
@@ -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
@@ -1,3 +1,3 @@
1
1
  module AMazeIng
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
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.3
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