fixed the issue where enemies could walk over a gap if it wasnt on a pathfinding node
This commit is contained in:
67
Scenes/CardPrinter/card_printer.gd
Normal file
67
Scenes/CardPrinter/card_printer.gd
Normal file
@ -0,0 +1,67 @@
|
||||
class_name CardPrinter extends StaticBody3D
|
||||
|
||||
@export var cards: Array[CardInHand]
|
||||
@export var item_card_scene: PackedScene
|
||||
@export var button_collider: CollisionShape3D
|
||||
@export var button_box: Node3D
|
||||
@export var choice_colliders: Array[CollisionShape3D]
|
||||
|
||||
var card_available: bool = false
|
||||
var reply_player: Hero
|
||||
|
||||
|
||||
func randomize_cards() -> void:
|
||||
var weight_total: int = 0
|
||||
for rarity: String in Data.Rarity:
|
||||
weight_total += Data.rarity_weights[rarity]
|
||||
|
||||
var generated_rarity: int = randi_range(0, weight_total)
|
||||
var decided_rarity: int = 0
|
||||
|
||||
for rarity: String in Data.Rarity:
|
||||
weight_total -= Data.rarity_weights[rarity]
|
||||
if generated_rarity >= weight_total:
|
||||
decided_rarity = Data.Rarity[rarity]
|
||||
break
|
||||
|
||||
var card_array: Array = []
|
||||
for x: Card in Data.cards:
|
||||
if x.rarity == decided_rarity:
|
||||
card_array.append(x)
|
||||
var card: Card
|
||||
for x: CardInHand in cards:
|
||||
if card_array.size() > 0:
|
||||
card = card_array.pick_random()
|
||||
card_array.erase(card)
|
||||
x.set_card(card)
|
||||
#TODO: in reality this should just show the icon and then hovering over it lets you see either side at the players own discretion
|
||||
x.view_tower()
|
||||
$Node3D.set_visible(true)
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.disabled = false
|
||||
card_available = true
|
||||
|
||||
|
||||
func retrieve_card(i: int, reply: Hero) -> void:
|
||||
$Node3D.set_visible(false)
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.disabled = true
|
||||
if card_available:
|
||||
var card: Card = cards[i].stats
|
||||
reply_player.add_card(card)
|
||||
#var item: ItemCard = item_card_scene.instantiate() as ItemCard
|
||||
#item.card = card
|
||||
#item.position = Vector3(1.683, 0, 0)
|
||||
#add_child(item)
|
||||
button_collider.disabled = false
|
||||
button_box.position = Vector3(0,0,0)
|
||||
$AudioStreamPlayer3D.play()
|
||||
reply_player = null
|
||||
|
||||
|
||||
func _on_static_body_3d_button_interacted(_value: int, reply: Hero) -> void:
|
||||
reply_player = reply
|
||||
button_collider.disabled = true
|
||||
button_box.position = Vector3(0,0,-0.2)
|
||||
$AudioStreamPlayer3D.play()
|
||||
randomize_cards()
|
@ -1,10 +1,10 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://1b2ikdanl66b"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://1b2ikdanl66b"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/card_printer.gd" id="1_7rhtj"]
|
||||
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="2_7ouw1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsasunnk47n8o" path="res://Scenes/item_card.tscn" id="2_356ip"]
|
||||
[ext_resource type="Script" path="res://Scripts/interact_button.gd" id="3_iia6u"]
|
||||
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="5_pf7c7"]
|
||||
[ext_resource type="Script" path="res://Scenes/CardPrinter/card_printer.gd" id="1_qft15"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsasunnk47n8o" path="res://Scenes/item_card.tscn" id="2_hegq8"]
|
||||
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="3_wygtg"]
|
||||
[ext_resource type="Script" path="res://Scripts/interact_button.gd" id="4_eavi1"]
|
||||
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="5_m033a"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_s02au"]
|
||||
albedo_color = Color(0.203922, 0.592157, 0.592157, 1)
|
||||
@ -12,9 +12,6 @@ albedo_color = Color(0.203922, 0.592157, 0.592157, 1)
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_0ebt5"]
|
||||
size = Vector3(2.672, 1.75, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_und3g"]
|
||||
size = Vector3(0.816972, 0.233429, 0.632978)
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_yf4je"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
@ -33,13 +30,13 @@ size = Vector3(0.763889, 0.773027, 0.0570252)
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_73g2w"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("5_pf7c7")
|
||||
stream_0/stream = ExtResource("5_m033a")
|
||||
stream_0/weight = 1.0
|
||||
|
||||
[node name="CardPrinter" type="StaticBody3D" node_paths=PackedStringArray("cards", "button_collider", "button_box", "choice_colliders")]
|
||||
script = ExtResource("1_7rhtj")
|
||||
script = ExtResource("1_qft15")
|
||||
cards = [NodePath("SubViewport/Node2D"), NodePath("SubViewport2/Node2D"), NodePath("SubViewport3/Node2D")]
|
||||
item_card_scene = ExtResource("2_356ip")
|
||||
item_card_scene = ExtResource("2_hegq8")
|
||||
button_collider = NodePath("StaticBody3D/CollisionShape3D2")
|
||||
button_box = NodePath("StaticBody3D/CollisionShape3D2/CSGBox3D")
|
||||
choice_colliders = [NodePath("StaticBody3D2/CollisionShape3D2"), NodePath("StaticBody3D3/CollisionShape3D2"), NodePath("StaticBody3D4/CollisionShape3D2")]
|
||||
@ -53,27 +50,23 @@ material = SubResource("StandardMaterial3D_s02au")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.875, 0)
|
||||
shape = SubResource("BoxShape3D_0ebt5")
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.6825, 0.484672, 0)
|
||||
shape = SubResource("BoxShape3D_und3g")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport" instance=ExtResource("2_7ouw1")]
|
||||
[node name="Node2D" parent="SubViewport" instance=ExtResource("3_wygtg")]
|
||||
|
||||
[node name="SubViewport2" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport2" instance=ExtResource("2_7ouw1")]
|
||||
[node name="Node2D" parent="SubViewport2" instance=ExtResource("3_wygtg")]
|
||||
|
||||
[node name="SubViewport3" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Node2D" parent="SubViewport3" instance=ExtResource("2_7ouw1")]
|
||||
[node name="Node2D" parent="SubViewport3" instance=ExtResource("3_wygtg")]
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="."]
|
||||
visible = false
|
||||
@ -97,7 +90,7 @@ texture = SubResource("ViewportTexture_vyyy4")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.444448, 0.610684)
|
||||
collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("3_iia6u")
|
||||
script = ExtResource("4_eavi1")
|
||||
press_cost = 15
|
||||
hover_text = "Spend 15 Coins to print card"
|
||||
|
||||
@ -111,7 +104,7 @@ size = Vector3(1.29447, 0.342125, 0.277604)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.756734, 1.15772, 0.610684)
|
||||
collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("3_iia6u")
|
||||
script = ExtResource("4_eavi1")
|
||||
hover_text = "Select card"
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D2"]
|
||||
@ -123,7 +116,7 @@ disabled = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0672475, 1.15772, 0.610684)
|
||||
collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("3_iia6u")
|
||||
script = ExtResource("4_eavi1")
|
||||
button_press_value = 1
|
||||
hover_text = "Select card"
|
||||
|
||||
@ -136,7 +129,7 @@ disabled = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.883877, 1.15772, 0.610684)
|
||||
collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("3_iia6u")
|
||||
script = ExtResource("4_eavi1")
|
||||
button_press_value = 2
|
||||
hover_text = "Select card"
|
||||
|
||||
@ -145,11 +138,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0466152, -0.0297148, -0.09
|
||||
shape = SubResource("BoxShape3D_gv3t5")
|
||||
disabled = true
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.6825, 0.484672, 0)
|
||||
size = Vector3(0.816972, 0.233429, 0.632978)
|
||||
material = SubResource("StandardMaterial3D_s02au")
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.433459, 0.524183)
|
||||
stream = SubResource("AudioStreamRandomizer_73g2w")
|
71
Scenes/ShopStand/shop_stand.gd
Normal file
71
Scenes/ShopStand/shop_stand.gd
Normal file
@ -0,0 +1,71 @@
|
||||
class_name ShopStand extends Node3D
|
||||
|
||||
@export var cards: Array[CardInHand]
|
||||
@export var choice_colliders: Array[CollisionShape3D]
|
||||
@export var choice_buttons: Array[InteractButton]
|
||||
@export var choice_sprites: Array[Sprite3D]
|
||||
@export var item_card_scene: PackedScene
|
||||
|
||||
var price_dict: Dictionary = {
|
||||
Data.Rarity.UNCOMMON : 30,
|
||||
Data.Rarity.RARE : 50,
|
||||
Data.Rarity.EPIC : 75,
|
||||
Data.Rarity.LEGENDARY : 100,
|
||||
}
|
||||
|
||||
|
||||
func close() -> void:
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.disabled = true
|
||||
for x: Sprite3D in choice_sprites:
|
||||
x.set_visible(false)
|
||||
|
||||
|
||||
func randomize_cards() -> void:
|
||||
var cheap_cards: Array[Card] = []
|
||||
var medium_cards: Array[Card] = []
|
||||
var pricey_cards: Array[Card] = []
|
||||
for card: Card in Data.cards:
|
||||
if card.rarity == Data.Rarity.UNCOMMON or card.rarity == Data.Rarity.RARE:
|
||||
cheap_cards.append(card)
|
||||
if card.rarity == Data.Rarity.RARE or card.rarity == Data.Rarity.EPIC:
|
||||
medium_cards.append(card)
|
||||
if card.rarity == Data.Rarity.EPIC or card.rarity == Data.Rarity.LEGENDARY:
|
||||
pricey_cards.append(card)
|
||||
|
||||
for x: int in 3:
|
||||
var chosen_card: Card = cheap_cards.pick_random()
|
||||
cards[x].set_card(chosen_card)
|
||||
cards[x].view_tower()
|
||||
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
for x: int in 2:
|
||||
var chosen_card: Card = medium_cards.pick_random()
|
||||
cards[x+3].set_card(chosen_card)
|
||||
cards[x+3].view_tower()
|
||||
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
for x: int in 1:
|
||||
var chosen_card: Card = pricey_cards.pick_random()
|
||||
cards[x+5].set_card(chosen_card)
|
||||
cards[x+5].view_tower()
|
||||
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.set_deferred("disabled", false)
|
||||
for x: Sprite3D in choice_sprites:
|
||||
x.set_visible(true)
|
||||
|
||||
|
||||
func retrieve_card(i: int, callback: Hero) -> void:
|
||||
#close()
|
||||
choice_colliders[i].disabled = true
|
||||
choice_sprites[i].set_visible(false)
|
||||
var card: Card = cards[i].stats
|
||||
callback.add_card(card)
|
||||
#var item: ItemCard = item_card_scene.instantiate() as ItemCard
|
||||
#item.card = card
|
||||
#item.position = Vector3(2.128, 0, 0)
|
||||
#add_child(item)
|
||||
#button_collider.disabled = false
|
||||
#button_box.position = Vector3(0,0,0)
|
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://7g3jev3v6d3l"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/shop_stand.gd" id="1_4in53"]
|
||||
[ext_resource type="Script" path="res://Scenes/ShopStand/shop_stand.gd" id="1_4in53"]
|
||||
[ext_resource type="Script" path="res://Scripts/interact_button.gd" id="1_x8sts"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsasunnk47n8o" path="res://Scenes/item_card.tscn" id="2_qh00w"]
|
||||
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="3_u7x2f"]
|
@ -25,6 +25,8 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 5
|
||||
theme_override_font_sizes/font_size = 60
|
||||
text = "12345"
|
||||
horizontal_alignment = 1
|
||||
|
@ -13,12 +13,12 @@ world_model = NodePath("CSGSphere3D")
|
||||
minimap_model = NodePath("Sprite3D")
|
||||
|
||||
[node name="CSGSphere3D" type="CSGSphere3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.401382, 0)
|
||||
radius = 0.05
|
||||
material = SubResource("StandardMaterial3D_lutld")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.242234, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.620933, 0)
|
||||
layers = 4
|
||||
texture_filter = 0
|
||||
texture = ExtResource("2_0gsds")
|
||||
|
Reference in New Issue
Block a user