Changeset 13583
- Timestamp:
- 06/09/08 15:55:30 (5 years ago)
- Location:
- lang/ruby/RogueLike/rogue_like
- Files:
-
- 1 added
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/RogueLike/rogue_like/chara.rb
r13479 r13583 3 3 module RogueLike 4 4 class Chara 5 attr_accessor :map_x, :map_y, :mode, :walk_pathes 5 attr_accessor :map_x, :map_y, :mode, :walk_pathes, :strength 6 6 7 7 def initialize(map_x, map_y) … … 10 10 @mode = :waiting 11 11 @walk_pathes = [] 12 @strength = 112 @strength = 5 13 13 end 14 14 -
lang/ruby/RogueLike/rogue_like/config.rb
r13479 r13583 27 27 GAME_TITLE = 'Rogue Like' 28 28 29 INIT_CHARA_NUM = 429 INIT_CHARA_NUM = 8 30 30 31 31 # g_random_int_range と同じ -
lang/ruby/RogueLike/rogue_like/map.rb
r13479 r13583 18 18 19 19 def left_click(x, y) 20 if in?(x, y) 21 map_x = (x - MAP_WINDOW_X) / CELL_W 22 map_y = (y - MAP_WINDOW_Y) / CELL_H 23 @left_click_cell = @data[map_y][map_x] 24 end 20 map_x = (x - MAP_WINDOW_X) / CELL_W 21 map_y = (y - MAP_WINDOW_Y) / CELL_H 22 @left_click_cell = @data[map_y][map_x] 25 23 end 26 24 -
lang/ruby/RogueLike/rogue_like/model.rb
r13479 r13583 4 4 require 'rogue_like/couple' 5 5 require 'rogue_like/chara' 6 require 'rogue_like/home' 6 7 require 'rogue_like/astar' 7 8 require 'rogue_like/bstar' … … 24 25 @debug_mode = nil 25 26 @wp = Workpile.new # ブロックを受け取りその実行を別スレッドに委託する 27 @home_map = Array.new(MAP_H) { Array.new(MAP_W) { nil } } 26 28 make_map 27 29 make_charas … … 57 59 @charas << Chara.new(x, y) 58 60 end 59 end 60 61 @select_chara = nil 62 end 63 61 64 # 区画を分割できなくなるまで分割する 62 65 def split_rect(parent) … … 173 176 if chara.walk_pathes.size > 0 174 177 chara.walk 178 if @charas.select {|c| c.x == chara.x and c.y == chara.y }.size > 1 179 @charas.delete(chara) 180 chara2 = @charas.find {|chara2| chara2.x == chara.x and chara2.y == chara.y } 181 chara.strength += chara2.strength 182 @charas.delete(chara2) 183 @charas << chara 184 end 175 185 else 176 186 if @map.data[chara.map_y][chara.map_x] == :room … … 181 191 end 182 192 when :building 183 @map.data[chara.map_y][chara.map_x] = :home 184 @map.draw_position(chara.map_x, chara.map_y) 185 chara.mode = :waiting 186 end 193 x = chara.map_x 194 y = chara.map_y 195 if @map.data[y][x] == :room 196 @map.data[y][x] = :pre_home 197 @home_map[y][x] = Home.new(x, y) 198 else 199 @home_map[y][x].strength += chara.strength 200 if @home_map[y][x].strength >= 50 201 @map.data[y][x] = :home 202 @map.draw_position(x, y) 203 chara.mode = :waiting 204 end 205 end 206 end 207 end 208 end 209 210 def left_click(x, y) 211 if @map.in?(x, y) 212 @select_chara = @charas.find {|chara| x == chara.x and y == chara.y } 213 @map.left_click(x, y) unless @select_chara 214 p @select_chara 187 215 end 188 216 end -
lang/ruby/RogueLike/rogue_like/view.rb
r13479 r13583 19 19 :road => Texture.load('images/road'), 20 20 :chara => Texture.load('images/chara'), 21 :pre_home => Texture.load('images/room'), 21 22 :home => Texture.load('images/home'), 22 23 :position => Texture.load('images/position'),
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)