fix/func: added beginnings of turn winning function. Fixed "Card_Container"s not appearing & dissapearing properly
This commit is contained in:
+122
-2
@@ -18,6 +18,8 @@ signal dealt
|
||||
|
||||
func _ready():
|
||||
trumpbuttons.trump.connect(define_trump.bind())
|
||||
player_1_pile.enable_drop_zone = false
|
||||
player_1_pile.sensor_visibility = false
|
||||
setup_game()
|
||||
|
||||
|
||||
@@ -31,7 +33,7 @@ func setup_game():
|
||||
deck._held_cards.shuffle()
|
||||
|
||||
# Deal initial hand
|
||||
const DEAL_PAUSE = 0.45
|
||||
const DEAL_PAUSE = 0.1
|
||||
var deal_r: int =1
|
||||
while true:
|
||||
deal_cards_to_hand(3, player_1_hand)
|
||||
@@ -55,9 +57,127 @@ func define_trump(suit : String):
|
||||
turn(first_player)
|
||||
|
||||
func turn(first):
|
||||
first.play_check()
|
||||
first.sensor_visibility = true
|
||||
first.enable_drop_zone = true
|
||||
first._redraw_drop_zone()
|
||||
await first.played
|
||||
first.enable_drop_zone = false
|
||||
first._redraw_drop_zone()
|
||||
match first:
|
||||
player_1_pile:
|
||||
|
||||
player_2_pile.sensor_visibility = true
|
||||
player_2_pile.enable_drop_zone = true
|
||||
player_2_pile._redraw_drop_zone()
|
||||
await player_2_pile.played
|
||||
player_2_pile.enable_drop_zone = false
|
||||
player_2_pile._redraw_drop_zone()
|
||||
|
||||
player_3_pile.sensor_visibility = true
|
||||
player_3_pile.enable_drop_zone = true
|
||||
player_3_pile._redraw_drop_zone()
|
||||
await player_3_pile.played
|
||||
player_3_pile.enable_drop_zone = false
|
||||
player_3_pile._redraw_drop_zone()
|
||||
|
||||
player_4_pile.sensor_visibility = true
|
||||
player_4_pile.enable_drop_zone = true
|
||||
player_4_pile._redraw_drop_zone()
|
||||
await player_4_pile.played
|
||||
player_4_pile.enable_drop_zone = false
|
||||
player_4_pile._redraw_drop_zone()
|
||||
|
||||
player_2_pile:
|
||||
|
||||
player_3_pile.sensor_visibility = true
|
||||
player_3_pile.enable_drop_zone = true
|
||||
player_3_pile._redraw_drop_zone()
|
||||
await player_3_pile.played
|
||||
player_3_pile.enable_drop_zone = false
|
||||
player_3_pile._redraw_drop_zone()
|
||||
|
||||
player_4_pile.sensor_visibility = true
|
||||
player_4_pile.enable_drop_zone = true
|
||||
player_4_pile._redraw_drop_zone()
|
||||
await player_4_pile.played
|
||||
player_4_pile.enable_drop_zone = false
|
||||
player_4_pile._redraw_drop_zone()
|
||||
|
||||
player_1_pile.sensor_visibility = true
|
||||
player_1_pile.enable_drop_zone = true
|
||||
player_1_pile._redraw_drop_zone()
|
||||
await player_1_pile.played
|
||||
player_1_pile.enable_drop_zone = false
|
||||
player_1_pile._redraw_drop_zone()
|
||||
|
||||
player_3_pile:
|
||||
|
||||
player_4_pile.sensor_visibility = true
|
||||
player_4_pile.enable_drop_zone = true
|
||||
player_4_pile._redraw_drop_zone()
|
||||
await player_4_pile.played
|
||||
player_4_pile.enable_drop_zone = false
|
||||
player_4_pile._redraw_drop_zone()
|
||||
|
||||
player_1_pile.sensor_visibility = true
|
||||
player_1_pile.enable_drop_zone = true
|
||||
player_1_pile._redraw_drop_zone()
|
||||
await player_1_pile.played
|
||||
player_1_pile.enable_drop_zone = false
|
||||
player_1_pile._redraw_drop_zone()
|
||||
|
||||
player_2_pile.sensor_visibility = true
|
||||
player_2_pile.enable_drop_zone = true
|
||||
player_2_pile._redraw_drop_zone()
|
||||
await player_2_pile.played
|
||||
player_2_pile.enable_drop_zone = false
|
||||
player_2_pile._redraw_drop_zone()
|
||||
|
||||
player_4_pile:
|
||||
player_1_pile.sensor_visibility = true
|
||||
player_1_pile.enable_drop_zone = true
|
||||
player_1_pile._redraw_drop_zone()
|
||||
await player_1_pile.played
|
||||
player_1_pile.enable_drop_zone = false
|
||||
player_1_pile._redraw_drop_zone()
|
||||
|
||||
player_2_pile.sensor_visibility = true
|
||||
player_2_pile.enable_drop_zone = true
|
||||
player_2_pile._redraw_drop_zone()
|
||||
await player_2_pile.played
|
||||
player_2_pile.enable_drop_zone = false
|
||||
player_2_pile._redraw_drop_zone()
|
||||
|
||||
player_3_pile.sensor_visibility = true
|
||||
player_3_pile.enable_drop_zone = true
|
||||
player_3_pile._redraw_drop_zone()
|
||||
await player_3_pile.played
|
||||
player_3_pile.enable_drop_zone = false
|
||||
player_3_pile._redraw_drop_zone()
|
||||
get_turn_winner()
|
||||
|
||||
|
||||
|
||||
|
||||
func get_turn_winner():
|
||||
var card_1 = player_1_pile.get_top_cards(1)[0]
|
||||
var card_2 = player_2_pile.get_top_cards(1)[0]
|
||||
var card_3 = player_3_pile.get_top_cards(1)[0]
|
||||
var card_4 = player_4_pile.get_top_cards(1)[0]
|
||||
var value_1 = card_1.card_info.value
|
||||
var value_2 = card_2.card_info.value
|
||||
var value_3 = card_3.card_info.value
|
||||
var value_4 = card_4.card_info.value
|
||||
|
||||
if trump == card_1.card_info.suit:
|
||||
match value_1:
|
||||
11:
|
||||
value_1 += 40
|
||||
9:
|
||||
value_1 += 30
|
||||
|
||||
func move_to_stiche(team: int):
|
||||
pass
|
||||
|
||||
func create_standard_deck():
|
||||
var suits = ["Club", "Diamond", "Heart", "Spade"]
|
||||
|
||||
Reference in New Issue
Block a user