Class: GamePlay::Casino::VoltorbFlip

Inherits:
Base show all
Defined in:
scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb

Constant Summary collapse

IncrementDuration =

Duration of the increment duration in frame

Returns:

  • (Float)
20.0
BoardDispX =
6
BoardDispY =
42
MemoDispX =
199
MemoDispY =
44
MemoTileDispOffX =
3
MemoTileDispOffY =
2
QuitDispX =
166
QuitDispY =
202
TileSize =
28
TileOffset =
32
MemoTileSize =
23
ColumnCoinDispX =
BoardDispX + MemoTileDispOffX + 9
ColumnCoinDispY =
BoardDispY + 5 * TileOffset + MemoTileDispOffY
RowCoinDispX =
BoardDispX + 5 * TileOffset + MemoTileDispOffX + 9
RowCoinDispY =
BoardDispY + MemoTileDispOffY
CursorMoveDuration =
8.0

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Instance Attribute Summary collapse

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initializeVoltorbFlip

Create the Voltorb Flip interface



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 32

def initialize
  super()
  # Init attributes
  @coin_case = $game_variables[Yuki::Var::CoinCase]
  @coin_gain = 0
  @coin_case_increase = [0, 0] # [target, step]
  @coin_gain_increase = [0, 0] # [target, step]
  @state = 0
  @level = 1
  # Init graphics
  @viewport = Viewport.create(:main, @message_window.z - 100)
  @over_viewport = Viewport.create(:main, @message_window.z - 1)
  create_background
  create_texts
  create_board
  create_memo
  Graphics.sort_z
  # Init logic
  generate_board
  # Cursor
  @cursor = UI::VoltorbFlip::Cursor.new(viewport)
  @black = Sprite.new(@over_viewport).set_bitmap('transparent_black', :interface)
end

Instance Attribute Details

#coin_caseInteger

The amount of coin in the coin case

Returns:



29
30
31
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 29

def coin_case
  @coin_case
end

Instance Method Details

#create_background

Create the background sprite



57
58
59
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 57

def create_background
  @background = Sprite.new(@viewport).set_bitmap('voltorbflip/empty_board', :interface)
end

#create_board

create the game board



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 69

def create_board
  @board_tiles = []
  @board_counters =
    Array.new(5) { |i| UI::VoltorbFlip::BoardCounter.new(@viewport, i, true) } +
    Array.new(5) { |i| UI::VoltorbFlip::BoardCounter.new(@viewport, i, false) }
  0.upto(4) do |bx|
    0.upto(4) do |by|
      rx = BoardDispX + 3 + bx * TileOffset
      ry = BoardDispY + 3 + by * TileOffset
      s = UI::VoltorbFlip::BoardTile.new(viewport)
      s.set_position(rx, ry)
      s.content = 1
      @board_tiles.push s
      @board_counters[5 + by].add_tile(s)
      @board_counters[bx].add_tile(s)
    end
  end

  @quit_button = Sprite.new(viewport).set_bitmap('voltorbflip/markers', :interface).set_rect_div(0, 0, 6, 1)
  @quit_button.set_position(QuitDispX, QuitDispY).opacity = 0

  @animation_sprite = UI::VoltorbFlip::Animation.new(@over_viewport)
end

#create_graphics



576
577
578
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 576

def create_graphics
  # Skipped to prevent glitches
end

#create_memo

Create the memo content



94
95
96
97
98
99
100
101
102
103
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 94

def create_memo
  @memo_sprites = []
  4.times do |index|
    s = UI::VoltorbFlip::MemoTile.new(@viewport, index)
    s.set_position(MemoDispX + MemoTileDispOffX, MemoDispY + MemoTileDispOffY + index * MemoTileSize)
    @memo_sprites[index] = s
  end
  @memo_disabler = Sprite.new(viewport).set_bitmap('voltorbflip/memo_button', :interface).set_rect_div(1, 0, 2, 1)
  @memo_disabler.set_position(MemoDispX + MemoTileDispOffX - 1, MemoDispY + MemoTileDispOffY + 4 * MemoTileSize)
end

#create_texts

Initialize the texts



62
63
64
65
66
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 62

def create_texts
  @ui_texts = UI::VoltorbFlip::Texts.new(@viewport)
  @ui_texts.title = ext_text(9000, 123) # 'voltorbataille'
  update_coin
end

#generate_board(level = 1)

Generate the board with the matching level

Parameters:

  • level (Integer, 1) (defaults to: 1)

    the level of the board to generate



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 477

def generate_board(level = 1)
  # Initialize
  point_count = 24 # Between 24 and 26 points distributed on the board, 26 if last distribution is a 3
  voltorb_count = 5 + 2 * level # The number of voltorb in the board
  chance_3 = [0, 50, 60, 60, 70, 70][level] # More 3 tile = less points in the board (prevent 4500 point boards)
  data = Table.new 5, 5 # The table
  available_coords = [] # The table coords
  point_coords = [] # The coords of the tile containing points
  5.times do |x|
    5.times do |y|
      available_coords.push [x, y]
    end
  end
  available_coords.shuffle!
  # Place the voltorbs and the first point
  available_coords.each do |coords|
    # No more than 4 voltorbs in a row / column
    v_row = 0
    v_col = 0
    5.times do |y|
      v_row += 1 if data[coords[0], y] < 0
    end
    5.times do |x|
      v_col += 1 if data[x, coords[1]] < 0
    end
    # Place a voltorb if possible, else place a point
    if v_row < 4 && v_col < 4 && voltorb_count > 0
      data[coords[0], coords[1]] = -1
      voltorb_count -= 1
    else
      data[coords[0], coords[1]] = 1
      point_count -= 1
      point_coords.push coords
    end
  end
  # Distribute the remaining points considering the 3 tile chances
  while point_count > 0
    # Select a tile
    c = point_coords.select do |a|
      if data[a[0], a[1]] == 2 # Will be 3
        next rand(100) < chance_3
      else
        next true
        end
    end.first
    # Add a point
    data[c[0], c[1]] += 1
    point_coords.delete(c) if data[c[0], c[1]] >= 3
    point_count -= 1
  end

  # data = Table.new(5, 5)
  # data[0, 0] = 3
  # data[1, 0] = 3
  # data[2, 0] = -1

  # Setup the tiles
  5.times do |x|
    5.times do |y|
      @board_tiles[x * 5 + y].content = (data[x, y] > 0 ? data[x, y] : :voltorb)
    end
  end
  # Update the counters
  @board_counters.each(&:update_display)
end

#get_board_points(with_hided = false) ⇒ Integer

Calculate the current point of the game

Parameters:

  • with_hided (Boolean, false) (defaults to: false)

    indicate if the hided tiles must be count too

Returns:



546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 546

def get_board_points(with_hided = false)
  points = 0 # Prevent to display 1 point even if there is no revealed tiles
  5.times do |x|
    5.times do |y|
      tile = @board_tiles[x * 5 + y]
      if tile.content.is_a?(Integer) && (with_hided || tile.revealed?)
        points = 1 if points.zero?
        points *= tile.content
      end
    end
  end
  return points
end

#get_increment(from, to) ⇒ Array<Float, Integer>

Calculate the increment value [step, target]

Returns:



572
573
574
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 572

def get_increment(from, to)
  return [(to - from) / IncrementDuration, to]
end

#get_revealed_tile_count



560
561
562
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 560

def get_revealed_tile_count
  return @board_tiles.select(&:revealed?).length
end

#incrementing?Boolean

Test if the coins are incrementing

Returns:

  • (Boolean)


566
567
568
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 566

def incrementing?
  return !(@coin_case_increase[0].zero? && @coin_gain_increase[0].zero?)
end

#on_board_activate(index = nil)

Called when the board is activated.

Parameters:

  • index (Integer, nil) (defaults to: nil)

    the index of the activate tile (by default the one under the cursor).



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 430

def on_board_activate(index = nil)
  index ||= (@cursor.board_x * 5 + @cursor.board_y)
  # Nothing to do with an revealed tile
  return if @board_tiles[index].revealed?

  # Normal mode : reveal the tile
  if @cursor.mode == :normal
    x = (index / 5)
    y = index - 5 * x
    h_counter = @board_counters[x]
    v_counter = @board_counters[5 + y]
    if h_counter.voltorb_count + v_counter.voltorb_count >= 5
      @state = 400 # Suspens
    else
      reveal(index)
    end
  else # Memo mode
    memo_index = @memo_sprites.index(@memo_sprites.select(&:enabled?).first)
    @board_tiles[index].toggle_memo(memo_index)
  end
end

#on_fail



467
468
469
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 467

def on_fail
  @state = 300
end

#on_memo_activate(y = @cursor.board_y)

Called when the memo is activated

Parameters:

  • y (Integer, @cursor.board_y) (defaults to: @cursor.board_y)

    the row in the memo



410
411
412
413
414
415
416
417
418
419
420
421
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 410

def on_memo_activate(y = @cursor.board_y)
  @memo_sprites.each_with_index do |memo, index|
    if index == y
      memo.enable
      @memo_disabler.set_rect_div(0, 0, 2, 1)
    else
      memo.disable
    end
  end
  @memo_disabler.set_rect_div(1, 0, 2, 1) if y == 4
  update_cursor_mode
end

#on_quit_button

Called when the quit button is activated



424
425
426
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 424

def on_quit_button
  @state = 110
end

#on_win



471
472
473
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 471

def on_win
  @state = 200
end

#process_button_A

Process the A button



365
366
367
368
369
370
371
372
373
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 365

def process_button_A
  if @cursor.board_x == 5 && @cursor.board_y <= 4
    on_memo_activate
  elsif @cursor.board_y == 5
    on_quit_button
  else
    on_board_activate
  end
end

#process_mouse_click

Process the click on the screen



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 376

def process_mouse_click
  mx = Mouse.x
  my = Mouse.y
  # Memos
  @memo_sprites.each_with_index do |memo, index|
    next unless memo.simple_mouse_in?(mx, my)

    @cursor.moveto(5, index)
    on_memo_activate(index)
    break
  end
  # Memo disabling
  if @memo_disabler.simple_mouse_in?(mx, my)
    @cursor.moveto(5, 4)
    on_memo_activate(4)
  end
  # Quit button
  if @quit_button.simple_mouse_in?(mx, my)
    @cursor.moveto(5, 5)
    on_quit_button
  end
  # Board
  @board_tiles.each_with_index do |tile, index|
    next unless tile.simple_mouse_in?(mx, my)

    x = (index / 5)
    y = index - 5 * x
    @cursor.moveto(x, y)
    on_board_activate(index)
  end
end

#reveal(index)



452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 452

def reveal(index)
  @board_tiles[index].reveal
  # Display the coin gain / loose
  if @board_tiles[index].content.is_a?(Integer)
    @coin_gain = 1 if @coin_gain == 0
    old_coin_gain = n_coin_gain = @coin_gain
    n_coin_gain *= @board_tiles[index].content
    @coin_gain_increase = get_increment(old_coin_gain, n_coin_gain) if old_coin_gain != n_coin_gain
    return true
  else
    on_fail
    return false
  end
end

#update

Update the scene



106
107
108
109
110
111
112
113
114
115
116
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 106

def update
  return unless super
  return if update_tiles_animation # If one or more tiles are animated
  return if @cursor.update_move # If curseur is moving
  return if update_coin # Update coin incrementation
  return if update_state # Update win, fail state

  @no_animation = false
  update_input_dir
  update_input
end

#update_coinBoolean

Update coin values and texts. Return true if the value is incrementing and the update must stop

Returns:

  • (Boolean)


301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 301

def update_coin
  # Update the display
  @ui_texts.coin_case = @coin_case
  @ui_texts.coin_gain = @coin_gain
  @ui_texts.level = @level
  # Increment
  if incrementing?
    @coin_case += @coin_case_increase[0]
    if @coin_case >= @coin_case_increase[1] && @coin_case_increase[0] > 0 ||
       @coin_case <= @coin_case_increase[1] && @coin_case_increase[0] < 0
      @coin_case_increase = [0, 0]
      @coin_case = @coin_case.to_i
    end
    @coin_gain += @coin_gain_increase[0]
    if @coin_gain >= @coin_gain_increase[1] && @coin_gain_increase[0] > 0 ||
       @coin_gain <= @coin_gain_increase[1] && @coin_gain_increase[0] < 0
      @coin_gain_increase = [0, 0]
      @coin_gain = @coin_gain.to_i
    end
    return true
  end
  return false
ensure
  $game_variables[Yuki::Var::CoinCase] = @coin_case.to_i
end

#update_cursor_mode

Update the cursor mode to normal or memo



360
361
362
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 360

def update_cursor_mode
  @cursor.mode = @memo_sprites.select(&:enabled?).empty? ? :normal : :memo
end

#update_input

Update the keyboard inpute



328
329
330
331
332
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 328

def update_input
  process_mouse_click if Mouse.trigger?(:mouse_left)
  process_button_A if Input.trigger?(:A)
  on_quit_button if Input.trigger?(:B)
end

#update_input_dir

Update the keyboard direction input



335
336
337
338
339
340
341
342
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 335

def update_input_dir
  case Input.dir4
  when 2 then @cursor.move_on_board(0, 1)
  when 4 then @cursor.move_on_board(-1, 0)
  when 6 then @cursor.move_on_board(1, 0)
  when 8 then @cursor.move_on_board(0, -1)
  end
end

#update_state

Update the game state



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 119

def update_state
  return (@running = false) if @state == 999

  case (@state / 100)
  when 0 # Menu
    return update_state_menu
  when 1 # Play
    return update_state_play
  when 2
    return update_state_win
  when 3
    return update_state_fail
  when 4
    return update_suspens
  end
  return false
end

#update_state_fail



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 242

def update_state_fail
  case @state
  when 300 # Fail : voltorb
    @counter = 0
    @state += 1
  when 301
    @state += 1 unless (@counter += 1) < 40
  when 302
    Audio.se_play('Audio/SE/voltorbflip/volt_fail', 120)
    @coin_gain_increase = get_increment(@coin_gain, 0)
    @state += 1
  when 303
    @last_level = @level
    @level = [@level, get_revealed_tile_count].min
    @coin_gain = 0
    @no_animation = true
    @board_tiles.each(&:reveal)
    @counter = 0
    @state += 1
  when 304
    @state += 1 unless (@counter += 1) < 120
  when 305
    display_message(ext_text(9000, 144)) # "Vous perdez tous les jetons de la manche...")
    if @last_level > @level
      display_message(ext_text(9000, 139) % @level) # "Le jeu est descendu au niveau #{@level}.")
    end
    $game_system.bgm_restore
    @state = 1
  end
  return true
end

#update_state_menu



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 137

def update_state_menu
  case @state
  when 0 # Intro
    @black.visible = true
    @player_choice = display_message(ext_text(9000, 124)) # 'Bienvenue au Voltbataille')
    @state += 1
  when 1 # New Game invite
    @black.visible = true
    @player_choice = display_message(ext_text(9000, 125) % @level, 1, ext_text(9000, 126), ext_text(9000, 127), ext_text(9000, 128))
    # "Jouer à Voltorbataille niveau #{@level} ?", 1, 'Jouer', 'Infos', 'Partir')
    if @player_choice == 0
      @state += 1
    elsif @player_choice == 1
      @state = 10
    else
      @state = 999
    end
  when 2
    @no_animation = true
    @board_tiles.each(&:hide)
    @state += 1
  when 3 # Wait new game ready
    generate_board(@level)
    @black.visible = false
    @state = 100 # Play
  when 10 # Infos
    @player_choice = display_message(ext_text(9000, 129), 1, ext_text(9000, 130), ext_text(9000, 131), ext_text(9000, 132), ext_text(9000, 133))
    # "Que voulez-vous savoir ?", 1, 'Règles', 'Indices', 'Le mémo', 'Retour')
    if @player_choice == 0
      display_message(ext_text(9000, 134)) # "### A ECRIRE ###")
    elsif @player_choice == 1
      display_message(ext_text(9000, 135)) # "### A ECRIRE ###")
    elsif @player_choice == 2
      display_message(ext_text(9000, 136)) # "### A ECRIRE ###")
    else
      @state = 1
    end
  end
  return true
end

#update_state_play



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 178

def update_state_play
  case @state
  when 100 # Play loop
    # Check if win
    if get_board_points(true) == get_board_points
      on_win
      return true
    end
  when 110 # Quit or B button
    @player_choice = display_message(ext_text(9000, 137) % @coin_gain, 1, ext_text(9000, 95), ext_text(9000, 96))
    # "Choisir 'Quitter' maintenant vous permet d'empocher #{@coin_gain} jetons.\nQuitter maintenant ?", 1, 'Oui', 'Non')
    if @player_choice == 0
      display_message(ext_text(9000, 138) % @coin_gain) # "Vous empochez #{@coin_gain} jetons !")
      @coin_case_increase = get_increment(@coin_case, @coin_case + @coin_gain)
      @state += 1
    else
      @state = 100
    end
  when 111
    @no_animation = true
    @board_tiles.each(&:reveal)
    @state += 1
    return true
  when 112
    @last_level = @level
    @level = 1
    if @last_level > @level
      display_message(ext_text(9000, 139) % @level) # "Le jeu est descendu au niveau #{@level}.")
    end
    @state = 1
  end
  return false
end

#update_state_win



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 212

def update_state_win
  case @state
  when 200 # WIN
    Audio.se_play('Audio/SE/voltorbflip/volt_extra_pay')
    display_message(ext_text(9000, 140)) # "Gagné !")
    display_message(ext_text(9000, 141)) # "Toutes les cartes de 2 et ou 3 points ont été retournées...")
    display_message(ext_text(9000, 142) % @coin_gain) # "Vous gagnez #{@coin_gain} jetons !")
    @state += 1
  when 201 # Increase score
    @coin_case_increase = get_increment(@coin_case, @coin_case + @coin_gain)
    @state += 1
  when 202 # Win reset gain
    @coin_gain_increase = get_increment(@coin_gain, 0)
    @state += 1
  when 203
    @no_animation = true
    @board_tiles.each(&:reveal)
    @coin_gain = 0 # Prevent negatif numbers
    @state += 1
  when 204
    @last_level = @level
    @level = [@level + 1, 5].min
    if @last_level < @level
      display_message(ext_text(9000, 143) % @level) # "Le jeu est monté niveau #{@level}, les gains sont plus importants.")
    end
    @state = 1 # New Game invite
  end
  return true
end

#update_suspens



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 274

def update_suspens
  case @state
  when 400 # Suspens
    $game_system.bgm_memorize
    $game_system.bgm_fade(0.5)
    @counter = 0
    @state += 1
  when 401
    @state += 1 unless (@counter += 1) < 20
  when 402
    Audio.se_play('Audio/se/voltorbflip/volt_suspense')
    @counter = 0
    @state += 1
  when 403
    @state += 1 unless (@counter += 1) < 200
  when 404
    index = (@cursor.board_x * 5 + @cursor.board_y)
    if reveal(index)
      @state = 100
    end
      $game_system.bgm_restore
  end
  return true
end

#update_tiles_animationBoolean

Update the tiles animation

Returns:

  • (Boolean)


346
347
348
349
350
351
352
353
354
355
356
357
# File 'scripts/01450 Systems/09000 Games/00002 VoltorbFlip/00001 Casino__VoltorbFlip.rb', line 346

def update_tiles_animation
  result = false
  @board_tiles.each do |tile|
    temp = tile.update_animation
    result ||= temp # not called if result != nil
  end
  unless @no_animation
    result ||= @animation_sprite.update_animation
    @animation_sprite.animate(result) if result.is_a?(UI::VoltorbFlip::BoardTile)
  end
  return (result == true)
end