[Ace] Mini-game issues

I am attempting my first script and I wanted that to be a black jack mini game in my game. It is used with a mix of a few event commands but the core code itself should make sense. The issue I'm having is with my hit method. I don't want to create 11 different methods for each chance that a player can hit again (and the dealer!), so I wanted to create one that could be reusable and just called with a few arguments thrown in to it. The only problem is the images don't stay. When the first hit is called the card shows and stays, once the second card is called the first card disappears and that continues for every hit that I call. I get why it's happening, but I don't know what to do to change it. I've tried creating a holder sprite, but nothing works.
 
Here is the code, if anyone can help I would greatly appreciate it (remember it's ugly because it's my first script and I have no idea how to clean it up!!):

Spoiler
class Game_Interpreter

# --------------------------------------------------------------------------
# Alias List
# --------------------------------------------------------------------------

alias cjl_blackjack_gameinterpreter_intialize_asf initialize
alias cjl_blackjack_gameinterpreter_update_asf update

# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
def initialize
super()
@one = Sprite.new()
@one.x = 56
@one.y = 258
@one.z = 150
@two = Sprite.new()
@two.x = 84
@two.y = 258
@two.z = 150
@three = Sprite.new()
@three.x = 56
@three.y = 58
@three.z = 150
@four = Sprite.new()
@four.x = 84
@four.y = 58
@four.z = 150
@number = Sprite.new()
@number.x = 0
@number.y = @two.y
@number.z = @two.z
cjl_blackjack_gameinterpreter_intialize_asf()
end

# ----------------------------------------------------------------------------
# Method to clear cards
# ----------------------------------------------------------------------------
def clearcard
@one.bitmap.dispose unless @one.bitmap == nil
@two.bitmap.dispose unless @two.bitmap == nil
@three.bitmap.dispose unless @three.bitmap == nil
@four.bitmap.dispose unless @four.bitmap == nil
@number.bitmap.dispose unless @number.bitmap == nil
end

# ----------------------------------------------------------------------------
# Main method
# ----------------------------------------------------------------------------


def black_jack
clearcard()

@ace_1 = false
@ace_2 = false

@deckofcards = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 ].to_a
@card_1 = @deckofcards.slice!(rand(@deckofcards.size))
@card_2 = @deckofcards.slice!(rand(@deckofcards.size))
@card_3 = @deckofcards.slice!(rand(@deckofcards.size))
@card_4 = @deckofcards.slice!(rand(@deckofcards.size))
# ----------------------------------------------------------------------------
# Player 1st Card
# ----------------------------------------------------------------------------
case @card_1
when 1
@one.bitmap = Cache.picture("Hearts_1")
@card_1 = 11
@ace_1 = true
when 2
@one.bitmap = Cache.picture("Hearts_2")
@card_1 = 2
when 3
@one.bitmap = Cache.picture("Hearts_3")
@card_1 = 3
when 4
@one.bitmap = Cache.picture("Hearts_4")
@card_1 = 4
when 5
@one.bitmap = Cache.picture("Hearts_5")
@card_1 = 5
when 6
@one.bitmap = Cache.picture("Hearts_6")
@card_1 = 6
when 7
@one.bitmap = Cache.picture("Hearts_7")
@card_1 = 7
when 8
@one.bitmap = Cache.picture("Hearts_8")
@card_1 = 8
when 9
@one.bitmap = Cache.picture("Hearts_9")
@card_1 = 9
when 10
@one.bitmap = Cache.picture("Hearts_10")
@card_1 = 10
when 11
@one.bitmap = Cache.picture("Hearts_J")
@card_1 = 10
when 12
@one.bitmap = Cache.picture("Hearts_Q")
@card_1 = 10
when 13
@one.bitmap = Cache.picture("Hearts_K")
@card_1 = 10
when 14
@one.bitmap = Cache.picture("Spades_1")
@card_1 = 11
@ace_1 = true
when 15
@one.bitmap = Cache.picture("Spades_2")
@card_1 = 2
when 16
@one.bitmap = Cache.picture("Spades_3")
@card_1 = 3
when 17
@one.bitmap = Cache.picture("Spades_4")
@card_1 = 4
when 18
@one.bitmap = Cache.picture("Spades_5")
@card_1 = 5
when 19
@one.bitmap = Cache.picture("Spades_6")
@card_1 = 6
when 20
@one.bitmap = Cache.picture("Spades_7")
@card_1 = 7
when 21
@one.bitmap = Cache.picture("Spades_8")
@card_1 = 8
when 22
@one.bitmap = Cache.picture("Spades_9")
@card_1 = 9
when 23
@one.bitmap = Cache.picture("Spades_10")
@card_1 = 10
when 24
@one.bitmap = Cache.picture("Spades_J")
@card_1 = 10
when 25
@one.bitmap = Cache.picture("Spades_Q")
@card_1 = 10
when 26
@one.bitmap = Cache.picture("Spades_K")
@card_1 = 10
when 27
@one.bitmap = Cache.picture("Clubs_1")
@card_1 = 11
@ace_1 = true
when 28
@one.bitmap = Cache.picture("Clubs_2")
@card_1 = 2
when 29
@one.bitmap = Cache.picture("Clubs_3")
@card_1 = 3
when 30
@one.bitmap = Cache.picture("Clubs_4")
@card_1 = 4
when 31
@one.bitmap = Cache.picture("Clubs_5")
@card_1 = 5
when 32
@one.bitmap = Cache.picture("Clubs_6")
@card_1 = 6
when 33
@one.bitmap = Cache.picture("Clubs_7")
@card_1 = 7
when 34
@one.bitmap = Cache.picture("Clubs_8")
@card_1 = 8
when 35
@one.bitmap = Cache.picture("Clubs_9")
@card_1 = 9
when 36
@one.bitmap = Cache.picture("Clubs_10")
@card_1 = 10
when 37
@one.bitmap = Cache.picture("Clubs_J")
@card_1 = 10
when 38
@one.bitmap = Cache.picture("Clubs_Q")
@card_1 = 10
when 39
@one.bitmap = Cache.picture("Clubs_K")
@card_1 = 10
when 40
@one.bitmap = Cache.picture("Diamonds_1")
@card_1 = 11
@ace_1 = true
when 41
@one.bitmap = Cache.picture("Diamonds_2")
@card_1 = 2
when 42
@one.bitmap = Cache.picture("Diamonds_3")
@card_1 = 3
when 43
@one.bitmap = Cache.picture("Diamonds_4")
@card_1 = 4
when 44
@one.bitmap = Cache.picture("Diamonds_5")
@card_1 = 5
when 45
@one.bitmap = Cache.picture("Diamonds_6")
@card_1 = 6
when 46
@one.bitmap = Cache.picture("Diamonds_7")
@card_1 = 7
when 47
@one.bitmap = Cache.picture("Diamonds_8")
@card_1 = 8
when 48
@one.bitmap = Cache.picture("Diamonds_9")
@card_1 = 9
when 49
@one.bitmap = Cache.picture("Diamonds_10")
@card_1 = 10
when 50
@one.bitmap = Cache.picture("Diamonds_J")
@card_1 = 10
when 51
@one.bitmap = Cache.picture("Diamonds_Q")
@card_1 = 10
when 52
@one.bitmap = Cache.picture("Diamonds_K")
@card_1 = 10
end
# ----------------------------------------------------------------------------
# Player 2nd Card
# ----------------------------------------------------------------------------
case @card_2
when 1
@two.bitmap = Cache.picture("Hearts_1")
@card_2 = 11
@ace_2 = true
when 2
@two.bitmap = Cache.picture("Hearts_2")
@card_2 = 2
when 3
@two.bitmap = Cache.picture("Hearts_3")
@card_2 = 3
when 4
@two.bitmap = Cache.picture("Hearts_4")
@card_2 = 4
when 5
@two.bitmap = Cache.picture("Hearts_5")
@card_2 = 5
when 6
@two.bitmap = Cache.picture("Hearts_6")
@card_2 = 6
when 7
@two.bitmap = Cache.picture("Hearts_7")
@card_2 = 7
when 8
@two.bitmap = Cache.picture("Hearts_8")
@card_2 = 8
when 9
@two.bitmap = Cache.picture("Hearts_9")
@card_2 = 9
when 10
@two.bitmap = Cache.picture("Hearts_10")
@card_2 = 10
when 11
@two.bitmap = Cache.picture("Hearts_J")
@card_2 = 10
when 12
@two.bitmap = Cache.picture("Hearts_Q")
@card_2 = 10
when 13
@two.bitmap = Cache.picture("Hearts_K")
@card_2 = 10
when 14
@two.bitmap = Cache.picture("Spades_1")
@card_2 = 11
@ace_2 = true
when 15
@two.bitmap = Cache.picture("Spades_2")
@card_2 = 2
when 16
@two.bitmap = Cache.picture("Spades_3")
@card_2 = 3
when 17
@two.bitmap = Cache.picture("Spades_4")
@card_2 = 4
when 18
@two.bitmap = Cache.picture("Spades_5")
@card_2 = 5
when 19
@two.bitmap = Cache.picture("Spades_6")
@card_2 = 6
when 20
@two.bitmap = Cache.picture("Spades_7")
@card_2 = 7
when 21
@two.bitmap = Cache.picture("Spades_8")
@card_2 = 8
when 22
@two.bitmap = Cache.picture("Spades_9")
@card_2 = 9
when 23
@two.bitmap = Cache.picture("Spades_10")
@card_2 = 10
when 24
@two.bitmap = Cache.picture("Spades_J")
@card_2 = 10
when 25
@two.bitmap = Cache.picture("Spades_Q")
@card_2 = 10
when 26
@two.bitmap = Cache.picture("Spades_K")
@card_2 = 10
when 27
@two.bitmap = Cache.picture("Clubs_1")
@card_2 = 11
@ace_2 = true
when 28
@two.bitmap = Cache.picture("Clubs_2")
@card_2 = 2
when 29
@two.bitmap = Cache.picture("Clubs_3")
@card_2 = 3
when 30
@two.bitmap = Cache.picture("Clubs_4")
@card_2 = 4
when 31
@two.bitmap = Cache.picture("Clubs_5")
@card_2 = 5
when 32
@two.bitmap = Cache.picture("Clubs_6")
@card_2 = 6
when 33
@two.bitmap = Cache.picture("Clubs_7")
@card_2 = 7
when 34
@two.bitmap = Cache.picture("Clubs_8")
@card_2 = 8
when 35
@two.bitmap = Cache.picture("Clubs_9")
@card_2 = 9
when 36
@two.bitmap = Cache.picture("Clubs_10")
@card_2 = 10
when 37
@two.bitmap = Cache.picture("Clubs_J")
@card_2 = 10
when 38
@two.bitmap = Cache.picture("Clubs_Q")
@card_2 = 10
when 39
@two.bitmap = Cache.picture("Clubs_K")
@card_2 = 10
when 40
@two.bitmap = Cache.picture("Diamonds_1")
@card_2 = 11
@ace_2 = true
when 41
@two.bitmap = Cache.picture("Diamonds_2")
@card_2 = 2
when 42
@two.bitmap = Cache.picture("Diamonds_3")
@card_2 = 3
when 43
@two.bitmap = Cache.picture("Diamonds_4")
@card_2 = 4
when 44
@two.bitmap = Cache.picture("Diamonds_5")
@card_2 = 5
when 45
@two.bitmap = Cache.picture("Diamonds_6")
@card_2 = 6
when 46
@two.bitmap = Cache.picture("Diamonds_7")
@card_2 = 7
when 47
@two.bitmap = Cache.picture("Diamonds_8")
@card_2 = 8
when 48
@two.bitmap = Cache.picture("Diamonds_9")
@card_2 = 9
when 49
@two.bitmap = Cache.picture("Diamonds_10")
@card_2 = 10
when 50
@two.bitmap = Cache.picture("Diamonds_J")
@card_2 = 10
when 51
@two.bitmap = Cache.picture("Diamonds_Q")
@card_2 = 10
when 52
@two.bitmap = Cache.picture("Diamonds_K")
@card_2 = 10
end
# ----------------------------------------------------------------------------
# Dealer 1st Card
# ----------------------------------------------------------------------------
case @card_3
when 1
@three.bitmap = Cache.picture("cardback")
@card_3 = 1
when 2
@three.bitmap = Cache.picture("cardback")
@card_3 = 2
when 3
@three.bitmap = Cache.picture("cardback")
@card_3 = 3
when 4
@three.bitmap = Cache.picture("cardback")
@card_3 = 4
when 5
@three.bitmap = Cache.picture("cardback")
@card_3 = 5
when 6
@three.bitmap = Cache.picture("cardback")
@card_3 = 6
when 7
@three.bitmap = Cache.picture("cardback")
@card_3 = 7
when 8
@three.bitmap = Cache.picture("cardback")
@card_3 = 8
when 9
@three.bitmap = Cache.picture("cardback")
@card_3 = 9
when 10
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 11
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 12
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 13
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 14
@three.bitmap = Cache.picture("cardback")
@card_3 = 1
when 15
@three.bitmap = Cache.picture("cardback")
@card_3 = 2
when 16
@three.bitmap = Cache.picture("cardback")
@card_3 = 3
when 17
@three.bitmap = Cache.picture("cardback")
@card_3 = 4
when 18
@three.bitmap = Cache.picture("cardback")
@card_3 = 5
when 19
@three.bitmap = Cache.picture("cardback")
@card_3 = 6
when 20
@three.bitmap = Cache.picture("cardback")
@card_3 = 7
when 21
@three.bitmap = Cache.picture("cardback")
@card_3 = 8
when 22
@three.bitmap = Cache.picture("cardback")
@card_3 = 9
when 23
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 24
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 25
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 26
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 27
@three.bitmap = Cache.picture("cardback")
@card_3 = 1
when 28
@three.bitmap = Cache.picture("cardback")
@card_3 = 2
when 29
@three.bitmap = Cache.picture("cardback")
@card_3 = 3
when 30
@three.bitmap = Cache.picture("cardback")
@card_3 = 4
when 31
@three.bitmap = Cache.picture("cardback")
@card_3 = 5
when 32
@three.bitmap = Cache.picture("cardback")
@card_3 = 6
when 33
@three.bitmap = Cache.picture("cardback")
@card_3 = 7
when 34
@three.bitmap = Cache.picture("cardback")
@card_3 = 8
when 35
@three.bitmap = Cache.picture("cardback")
@card_3 = 9
when 36
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 37
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 38
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 39
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 40
@three.bitmap = Cache.picture("cardback")
@card_3 = 1
when 41
@three.bitmap = Cache.picture("cardback")
@card_3 = 2
when 42
@three.bitmap = Cache.picture("cardback")
@card_3 = 3
when 43
@three.bitmap = Cache.picture("cardback")
@card_3 = 4
when 44
@three.bitmap = Cache.picture("cardback")
@card_3 = 5
when 45
@three.bitmap = Cache.picture("cardback")
@card_3 = 6
when 46
@three.bitmap = Cache.picture("cardback")
@card_3 = 7
when 47
@three.bitmap = Cache.picture("cardback")
@card_3 = 8
when 48
@three.bitmap = Cache.picture("cardback")
@card_3 = 9
when 49
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 50
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 51
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
when 52
@three.bitmap = Cache.picture("cardback")
@card_3 = 10
end
# ----------------------------------------------------------------------------
# Dealer 2nd Card
# ----------------------------------------------------------------------------

case @card_4
when 1
@four.bitmap = Cache.picture("Hearts_1")
@card_4 = 11
when 2
@four.bitmap = Cache.picture("Hearts_2")
@card_4 = 2
when 3
@four.bitmap = Cache.picture("Hearts_3")
@card_4 = 3
when 4
@four.bitmap = Cache.picture("Hearts_4")
@card_4 = 4
when 5
@four.bitmap = Cache.picture("Hearts_5")
@card_4 = 5
when 6
@four.bitmap = Cache.picture("Hearts_6")
@card_4 = 6
when 7
@four.bitmap = Cache.picture("Hearts_7")
@card_4 = 7
when 8
@four.bitmap = Cache.picture("Hearts_8")
@card_4 = 8
when 9
@four.bitmap = Cache.picture("Hearts_9")
@card_4 = 9
when 10
@four.bitmap = Cache.picture("Hearts_10")
@card_4 = 10
when 11
@four.bitmap = Cache.picture("Hearts_J")
@card_4 = 10
when 12
@four.bitmap = Cache.picture("Hearts_Q")
@card_4 = 10
when 13
@four.bitmap = Cache.picture("Hearts_K")
@card_4 = 10
when 14
@four.bitmap = Cache.picture("Spades_1")
@card_4 = 11
when 15
@four.bitmap = Cache.picture("Spades_2")
@card_4 = 2
when 16
@four.bitmap = Cache.picture("Spades_3")
@card_4 = 3
when 17
@four.bitmap = Cache.picture("Spades_4")
@card_4 = 4
when 18
@four.bitmap = Cache.picture("Spades_5")
@card_4 = 5
when 19
@four.bitmap = Cache.picture("Spades_6")
@card_4 = 6
when 20
@four.bitmap = Cache.picture("Spades_7")
@card_4 = 7
when 21
@four.bitmap = Cache.picture("Spades_8")
@card_4 = 8
when 22
@four.bitmap = Cache.picture("Spades_9")
@card_4 = 9
when 23
@four.bitmap = Cache.picture("Spades_10")
@card_4 = 10
when 24
@four.bitmap = Cache.picture("Spades_J")
@card_4 = 10
when 25
@four.bitmap = Cache.picture("Spades_Q")
@card_4 = 10
when 26
@four.bitmap = Cache.picture("Spades_K")
@card_4 = 10
when 27
@four.bitmap = Cache.picture("Clubs_1")
@card_4 = 11
when 28
@four.bitmap = Cache.picture("Clubs_2")
@card_4 = 2
when 29
@four.bitmap = Cache.picture("Clubs_3")
@card_4 = 3
when 30
@four.bitmap = Cache.picture("Clubs_4")
@card_4 = 4
when 31
@four.bitmap = Cache.picture("Clubs_5")
@card_4 = 5
when 32
@four.bitmap = Cache.picture("Clubs_6")
@card_4 = 6
when 33
@four.bitmap = Cache.picture("Clubs_7")
@card_4 = 7
when 34
@four.bitmap = Cache.picture("Clubs_8")
@card_4 = 8
when 35
@four.bitmap = Cache.picture("Clubs_9")
@card_4 = 9
when 36
@four.bitmap = Cache.picture("Clubs_10")
@card_4 = 10
when 37
@four.bitmap = Cache.picture("Clubs_J")
@card_4 = 10
when 38
@four.bitmap = Cache.picture("Clubs_Q")
@card_4 = 10
when 39
@four.bitmap = Cache.picture("Clubs_K")
@card_4 = 10
when 40
@four.bitmap = Cache.picture("Diamonds_1")
@card_4 = 11
when 41
@four.bitmap = Cache.picture("Diamonds_2")
@card_4 = 2
when 42
@four.bitmap = Cache.picture("Diamonds_3")
@card_4 = 3
when 43
@four.bitmap = Cache.picture("Diamonds_4")
@card_4 = 4
when 44
@four.bitmap = Cache.picture("Diamonds_5")
@card_4 = 5
when 45
@four.bitmap = Cache.picture("Diamonds_6")
@card_4 = 6
when 46
@four.bitmap = Cache.picture("Diamonds_7")
@card_4 = 7
when 47
@four.bitmap = Cache.picture("Diamonds_8")
@card_4 = 8
when 48
@four.bitmap = Cache.picture("Diamonds_9")
@card_4 = 9
when 49
@four.bitmap = Cache.picture("Diamonds_10")
@card_4 = 10
when 50
@four.bitmap = Cache.picture("Diamonds_J")
@card_4 = 10
when 51
@four.bitmap = Cache.picture("Diamonds_Q")
@card_4 = 10
when 52
@four.bitmap = Cache.picture("Diamonds_K")
@card_4 = 10
end

if @card_1 + @card_2 == 22
@card_2 = 1
end
if @card_3 + @card_4 == 22
@card_4 = 1
end
@player_total = @card_1 + @card_2
@dealer_total = @card_3 + @card_4

$game_variables[38] = @player_total
$game_variables[37] = @dealer_total
return @one && @two && @three && @four
end


def hit(number, last)

@new_cardvalue = @deckofcards.slice!(rand(@deckofcards.size))

@number = number
@number = Sprite.new()
case @new_cardvalue
when 1
@number.bitmap = Cache.picture("Hearts_1")
@new_cardvalue = 1
when 2
@number.bitmap = Cache.picture("Hearts_2")
@new_cardvalue = 2
when 3
@number.bitmap = Cache.picture("Hearts_3")
@new_cardvalue = 3
when 4
@number.bitmap = Cache.picture("Hearts_4")
@new_cardvalue = 4
when 5
@number.bitmap = Cache.picture("Hearts_5")
@new_cardvalue = 5
when 6
@number.bitmap = Cache.picture("Hearts_6")
@new_cardvalue = 6
when 7
@number.bitmap = Cache.picture("Hearts_7")
@new_cardvalue = 7
when 8
@number.bitmap = Cache.picture("Hearts_8")
@new_cardvalue = 8
when 9
@number.bitmap = Cache.picture("Hearts_9")
@new_cardvalue = 9
when 10
@number.bitmap = Cache.picture("Hearts_10")
@new_cardvalue = 10
when 11
@number.bitmap = Cache.picture("Hearts_J")
@new_cardvalue = 10
when 12
@number.bitmap = Cache.picture("Hearts_Q")
@new_cardvalue = 10
when 13
@number.bitmap = Cache.picture("Hearts_K")
@new_cardvalue = 10
when 14
@number.bitmap = Cache.picture("Spades_1")
@new_cardvalue = 1
when 15
@number.bitmap = Cache.picture("Spades_2")
@new_cardvalue = 2
when 16
@number.bitmap = Cache.picture("Spades_3")
@new_cardvalue = 3
when 17
@number.bitmap = Cache.picture("Spades_4")
@new_cardvalue = 4
when 18
@number.bitmap = Cache.picture("Spades_5")
@new_cardvalue = 5
when 19
@number.bitmap = Cache.picture("Spades_6")
@new_cardvalue = 6
when 20
@number.bitmap = Cache.picture("Spades_7")
@new_cardvalue = 7
when 21
@number.bitmap = Cache.picture("Spades_8")
@new_cardvalue = 8
when 22
@number.bitmap = Cache.picture("Spades_9")
@new_cardvalue = 9
when 23
@number.bitmap = Cache.picture("Spades_10")
@new_cardvalue = 10
when 24
@number.bitmap = Cache.picture("Spades_J")
@new_cardvalue = 10
when 25
@number.bitmap = Cache.picture("Spades_Q")
@new_cardvalue = 10
when 26
@number.bitmap = Cache.picture("Spades_K")
@new_cardvalue = 10
when 27
@number.bitmap = Cache.picture("Clubs_1")
@new_cardvalue = 1
when 28
@number.bitmap = Cache.picture("Clubs_2")
@new_cardvalue = 2
when 29
@number.bitmap = Cache.picture("Clubs_3")
@new_cardvalue = 3
when 30
@number.bitmap = Cache.picture("Clubs_4")
@new_cardvalue = 4
when 31
@number.bitmap = Cache.picture("Clubs_5")
@new_cardvalue = 5
when 32
@number.bitmap = Cache.picture("Clubs_6")
@new_cardvalue = 6
when 33
@number.bitmap = Cache.picture("Clubs_7")
@new_cardvalue = 7
when 34
@number.bitmap = Cache.picture("Clubs_8")
@new_cardvalue = 8
when 35
@number.bitmap = Cache.picture("Clubs_9")
@new_cardvalue = 9
when 36
@number.bitmap = Cache.picture("Clubs_10")
@new_cardvalue = 10
when 37
@number.bitmap = Cache.picture("Clubs_J")
@new_cardvalue = 10
when 38
@number.bitmap = Cache.picture("Clubs_Q")
@new_cardvalue = 10
when 39
@number.bitmap = Cache.picture("Clubs_K")
@new_cardvalue = 10
when 40
@number.bitmap = Cache.picture("Diamonds_1")
@new_cardvalue = 1
when 41
@number.bitmap = Cache.picture("Diamonds_2")
@new_cardvalue = 2
when 42
@number.bitmap = Cache.picture("Diamonds_3")
@new_cardvalue = 3
when 43
@number.bitmap = Cache.picture("Diamonds_4")
@new_cardvalue = 4
when 44
@number.bitmap = Cache.picture("Diamonds_5")
@new_cardvalue = 5
when 45
@number.bitmap = Cache.picture("Diamonds_6")
@new_cardvalue = 6
when 46
@number.bitmap = Cache.picture("Diamonds_7")
@new_cardvalue = 7
when 47
@number.bitmap = Cache.picture("Diamonds_8")
@new_cardvalue = 8
when 48
@number.bitmap = Cache.picture("Diamonds_9")
@new_cardvalue = 9
when 49
@number.bitmap = Cache.picture("Diamonds_10")
@new_cardvalue = 10
when 50
@number.bitmap = Cache.picture("Diamonds_J")
@new_cardvalue = 10
when 51
@number.bitmap = Cache.picture("Diamonds_Q")
@new_cardvalue = 10
when 52
@number.bitmap = Cache.picture("Diamonds_K")
@new_cardvalue = 10
end

@number.x = last + 28
@number.y = @two.y
@number.z = @two.z


if @new_cardvalue == 11
if @player_total + @new_cardvalue > 21
@new_cardvalue = 1
end
end

if @ace_1 == true
if @player_total + @new_cardvalue > 21
@player_total -= 10
end
elsif @ace_2 == true
if @player_total + @new_cardvalue > 21
@player_total -= 10
end
end

@player_total += @new_cardvalue
$game_variables[38] = @player_total
return @number
end



def update
if @one.bitmap != nil
if $game_player.moving?
clearcard()
end
end
cjl_blackjack_gameinterpreter_update_asf()
end


end
I'm sure I seen this earlier in a different post...

Anyway... Please put a spoiler around your code. Its way too long to just leave visible and it causes people to get bored while scrolling down the page.
Thanks for the input. All fixed up.
Thats much easier on the eyes.

I have to ask. Why are you doing your full script within the Game_Interpreter class?
I was just under the impression I had to in order to call my script from an event :/
I am afraid you have misunderstood.

Generally speaking, you would make a scene. Personally, I always just copy Scene_Status and then change the name Scene_Whatever and change the code to do what I want.

Then I would create a method within the Game_Interpreter class to call this scene..

something like...

class Game_Interpreter  def my_method    SceneManager.call(Scene_Whatever)  endend
But really, this is not necessary as if you are making a custom scene, you could simply use the scrip call 'SceneManager.call(Scene_Name)' to call your scene.
Thank you! That's good to know. Have you had a chance to look at the script itself yet?
Yes I did.

I think your first step should be to put your script into its own scene, rather than the interpreter. This is because there can be many instances of the interpreter running at the same time. You dont want to be running the card game for each of them.

Then you should make your code shorter. Methods dont need to be so long. They can be shortened for efficiency.

This will make it easier to track down the fault / cause of error.
Thank you. I will start on that as soon as I get home. I am stuck between airports currently.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
I would say it would be a lot cleaner if you had the bitmaps stored in an Array indexed by card name and suit.  For example:

Deck_Pictures = []

Deck_Pictures << Bitmap.new(ace of hearts)

Deck_Pictures << Bitmap.new(2 of hearts)

...

Deck_Pictures << Bitmap.new(ace of clubs)

...

Then, to reference:

Deck_Pictures[suit*13 + card]

Each of these could be rendered in a separate Window, those of which could be Arrays on a per-player basis:

Player_1_cards  = []

Player_1_cards << Window.new(x, y, width, height)

Then, blt the Bitmaps into each Window as needed.

That would make the code a lot easier to maintain.

 

The cards would be initialized in one place, and re-used for each Player.
Okay I am doing my best to move this in to a scene but I am at a loss on how to get key input and choices, but I am working through it. Haven't had much time. @whitesphere: I am not exactly sure what you mean by any of that. I get the putting the images in arrays but I don't see how that'll shorten the code. I am obviously missing something haha.
Key input = Input.trigger?🙂Key)

You should check the input section of the help guide for more info on that.

Once you have an array that stores the image names for each card... something like...

['Heart_1', 'Heart_2', 'Heart_3'...]Then you will only need to check that array to get the picture information, rather than repeating the code that checks which card image to show.

Original thread: https://forums.rpgmakerweb.com/threads/ace-mini-game-issues.25486/