9.25下午

This commit is contained in:
TsubakiLoL 2024-09-25 18:04:02 +08:00
parent 0bf7090291
commit 11b972d7e1
25 changed files with 451 additions and 59 deletions

View File

@ -42,8 +42,30 @@ var now_game_data:Dictionary={
"spirit":999,
"map":"map_01",
"move_ability":1,
"time_unix":0
"time_unix":0,
"card_in_bag":["card_03","card_03","card_02","card_02","card_01","card_01","card_01","card_01"]
}
#当前战斗场景
var now_fight_scene:FightScene
#向卡组中添加卡牌
func add_card(card_id:String):
now_game_data["card_in_bag"].append(card_id)
#从卡组中删除卡牌
func delete_card(card_id:String)->bool:
var now_arr:Array= now_game_data["card_in_bag"]
var ind=now_arr.find(card_id)
if ind==-1:
return false
else:
now_game_data["card_in_bag"].pop_at(ind)
return true
#使用卡牌
func use_card(card_data:Dictionary,target=null):
print("执行了卡牌:\n"+str(card_data)+"\n目标"+str(target))
pass
func get_all_card()->Array:
return now_game_data["card_in_bag"].duplicate()
func get_move_ability():
return now_game_data["move_ability"]
func get_time_dictionary():

View File

@ -2,16 +2,19 @@
"card_01":{
"name":"测试卡01(友方目标)",
"icon":"?",
"target_queue":0
"target_queue":0,
"cost":0
},
"card_02":{
"name":"测试卡02(不需要目标)",
"icon":"?",
"cost":1
},
"card_03":{
"name":"测试卡03(敌方目标)",
"icon":"?",
"target_queue":1
"target_queue":1,
"cost":2
},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bncj5637mf3b"
path="res://.godot/imported/tuceng355.png-401d1420bb656cbc48d771274c241e9a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res/ui/ui_026_1_arrow/tuceng355.png"
dest_files=["res://.godot/imported/tuceng355.png-401d1420bb656cbc48d771274c241e9a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://6hve0s4ensqw"
path="res://.godot/imported/tuceng356.png-60b2888e93551ccfe2ff81bc502cb8d9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res/ui/ui_026_1_arrow/tuceng356.png"
dest_files=["res://.godot/imported/tuceng356.png-60b2888e93551ccfe2ff81bc502cb8d9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -5,6 +5,7 @@ class_name Card
@onready var arrow: card_arrow = $arrow
var target_queue:int=-1
var scale_multiple:float=1.1
signal queue
func _ready() -> void:
state_machine.launch()
@ -22,12 +23,12 @@ var data:Dictionary
##设置卡牌信息
func set_data(id:String):
var d=Global.get_card_data(id)
print(d)
if d!=null:
data=d
fight_card.set_data(d)
if data.has("target_queue"):
target_queue=data["target_queue"]
arrow.set_select_queue(target_queue)
pass
##该卡牌是否需要选择目标
func need_target():
@ -44,10 +45,11 @@ func move_to(from_pos:Vector2,to_pos:Vector2,time:float=0.5):
tween.set_trans(Tween.TRANS_QUAD)
tween.tween_property(self,"position",to_pos,time)
tween.tween_callback(move_finished)
last_move_tween=tween
signal move_finished_sig
func move_finished():
state_machine.send_message("move_finished")
move_finished_sig.emit()
pass
func up():
z_index=1
@ -56,6 +58,10 @@ func up():
func down():
z_index=0
scale_to(1)
func show_big():
z_index=1
scale_to(1.5)
var last_scale_tween:Tween
func scale_to(sc:float):
if last_scale_tween!=null:
@ -65,8 +71,11 @@ func scale_to(sc:float):
func get_machine()->CardMachine:
return get_parent()
func get_self_index_position():
return get_machine().get_index_position(get_index())
return get_machine().get_index_position(get_machine().get_card_index(self))
func get_queue_position():
return get_machine().get_queue_pos()
func get_exe_position():
return get_machine().get_exe_position()
func request_resize():
state_machine.send_message("resize")
func open_arrow():
@ -75,3 +84,22 @@ func close_arrow():
arrow.stop()
func set_arrow_queue(q:int):
arrow.set_select_queue(q)
func get_select_result():
return arrow.get_target()
func clear():
state_machine.change_state("discard",0)
#执行目标
var target
func exe():
print("exe")
move_to(self.position,get_exe_position())
await move_finished_sig
show_big()
await get_tree().create_timer(0.2).timeout
Global.use_card(data,target)
await get_tree().create_timer(0.2).timeout
down()
print("执行完毕")
state_machine.change_state("discard",0)
return 0

View File

@ -63,6 +63,7 @@ script = ExtResource("9_40m88")
script = ExtResource("12_sl7jh")
[node name="arrow" parent="." instance=ExtResource("11_gjfgy")]
texture_num = 20
[connection signal="mouse_entered" from="fight_card" to="." method="_on_fight_card_mouse_entered"]
[connection signal="mouse_exited" from="fight_card" to="." method="_on_fight_card_mouse_exited"]

View File

@ -49,6 +49,7 @@ func replace_texture():
var mouse_pos=(get_global_mouse_position()-self.global_position)
area.global_position=get_global_mouse_position()
texture_array[0].rotation=texture_array[1].rotation
texture_array[0].scale=Vector2(0.1,0.1)
for i in range(1,texture_array.size()):
var t=logWithBase(float(i)/(texture_array.size()-1)+1,2)
var res=get_bezier_position(self.position,mouse_pos,t)
@ -83,3 +84,14 @@ func stop():
is_start=false
area.monitoring=false
area.monitorable=false
func get_target():
var group=area.get_overlapping_areas()
if group.size()<=0:
return null
else:
var character=group[0].get_parent()
if character is FightCharacterCard or character is FightEnermyCard:
return character
else:
return null
pass

View File

@ -1,28 +1,12 @@
[gd_scene load_steps=9 format=3 uid="uid://c7vtcaeg4nkbu"]
[gd_scene load_steps=7 format=3 uid="uid://c7vtcaeg4nkbu"]
[ext_resource type="Script" path="res://scene/card_state_machine/arrow.gd" id="1_oqukl"]
[ext_resource type="PackedScene" uid="uid://dg27pietgq7qd" path="res://scene/card_state_machine/arrowImg.tscn" id="2_ba6kg"]
[sub_resource type="Gradient" id="Gradient_7pfi1"]
offsets = PackedFloat32Array(0, 0.466667, 0.509804)
colors = PackedColorArray(0, 0.463205, 0.823238, 1, 0, 0.462745, 0.823529, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_qscu6"]
gradient = SubResource("Gradient_7pfi1")
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="Gradient" id="Gradient_8a280"]
offsets = PackedFloat32Array(0, 0.278431, 0.305882)
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_t54e3"]
gradient = SubResource("Gradient_8a280")
fill = 2
fill_from = Vector2(0.517094, 1)
[ext_resource type="Texture2D" uid="uid://6hve0s4ensqw" path="res://res/ui/ui_026_1_arrow/tuceng356.png" id="2_hhxo0"]
[ext_resource type="Texture2D" uid="uid://bncj5637mf3b" path="res://res/ui/ui_026_1_arrow/tuceng355.png" id="3_rp6eo"]
[sub_resource type="Curve" id="Curve_035f2"]
_data = [Vector2(0, 0.600293), 0.0, 0.0, 0, 0, Vector2(1e-05, 0.581259), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
_data = [Vector2(0, 0.600293), 0.0, 0.0, 0, 0, Vector2(1e-05, 0.200586), 0.0, 0.0, 0, 0, Vector2(1, 0.210102), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CircleShape2D" id="CircleShape2D_cys1g"]
@ -32,9 +16,9 @@ radius = 11.1803
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_oqukl")
texture_circle = SubResource("GradientTexture2D_qscu6")
texture_arrow = SubResource("GradientTexture2D_t54e3")
texture_num = 20
texture_circle = ExtResource("2_hhxo0")
texture_arrow = ExtResource("3_rp6eo")
texture_num = 10
arrowImageScene = ExtResource("2_ba6kg")
curve = SubResource("Curve_035f2")
max_scale = 1.0

View File

@ -6,39 +6,72 @@ var rand_release:float=20
var distance:float=100
var card_arr:Array[Card]=[]
var queue_card:Array[Card]=[]
var energy_start:int=3
var energy:int=0
func get_index_position(index:int)->Vector2:
var center=size/2
var left=center-Vector2(distance*card_arr.size()/2,0)
var rand_y=randf_range(-10,10)
return left+Vector2(distance*index,rand_y)
func _ready() -> void:
add_card("xxx",4)
func get_put_pos():
return size/2
func add_card(card_id:String,num:int):
func get_discard_pos()->Vector2:
return size
pass
func add_card(card_id:String,num:int=1):
for i in num:
var new_card=CARD.instantiate() as Card
add_child(new_card)
new_card.set_data(card_id)
card_arr.append(new_card)
new_card.queue.connect(card_queue.bind(new_card))
for j in card_arr:
j.request_resize()
pass
func get_card_index(card:Card):
if card in card_arr:
return card_arr.find(card)
else:
return 0
func card_queue(card:Card):
queue_card.append(card)
pass
#获取释放位置
func get_release_pos()->Vector2:
func get_queue_pos()->Vector2:
var pos:Vector2
if release_card_pos!=null:
pos=release_card_pos.position
pos=release_card_pos.global_position -self.global_position
else:
pos=Vector2.ZERO
var rand:Vector2=Vector2(randf_range(-rand_release,rand_release),randf_range(-rand_release,rand_release))
return pos+rand
@export var exe_card_pos:Control
func get_exe_position():
var pos:Vector2
if release_card_pos!=null:
pos=exe_card_pos.global_position -self.global_position
else:
pos=Vector2.ZERO
var rand:Vector2=Vector2(randf_range(-rand_release,rand_release),randf_range(-rand_release,rand_release))
return pos+rand
func add_to_queue(card:Card):
func clear_card():
for i in card_arr:
if not i in queue_card:
i.clear()
card_arr.clear()
if queue_card.size()==0:
queue_card.append(card)
card.send("your_turn")
pass
func exe_queue():
var i:int=0
while i<queue_card.size():
await queue_card[i].exe()
i+=1
print("清理队列")
queue_card.clear()
pass

View File

@ -1 +1,24 @@
extends State
func enter_state(n):
var player:Card=get_player()
var target_pos=player.get_machine().get_discard_pos()
player.move_to(player.position,target_pos)
func update_state(delta):
pass
func update_state_phy(delta):
pass
func exit_state():
pass
func time_out():
pass
func process_message(type:String,n):
match type:
"move_finished":
print("删除")
get_player().queue_free()
return
pass

View File

@ -1 +1,23 @@
extends State
var target
func enter_state(n):
target=n
get_player().exe()
func update_state(delta):
pass
func update_state_phy(delta):
pass
func exit_state():
pass
func time_out():
pass
func process_message(type:String,n):
match type:
"move_finished":
change_to_state("idle")
return
pass

View File

@ -5,7 +5,6 @@ func enter_state(n):
pass
func update_state(delta):
if Input.is_action_just_pressed("mouse_left"):
print("change")
change_to_state("selected")
return
func update_state_phy(delta):

View File

@ -23,4 +23,7 @@ func process_message(type:String,n):
player.move_to(player.position,target_position)
pass
"clear":
change_to_state("discard")
return
pass

View File

@ -1 +1,18 @@
extends State
func enter_state(n):
var player:Card=get_player()
player.move_to(player.position,player.get_queue_position())
player.target=n
player.queue.emit()
pass
func update_state(delta):
pass
func update_state_phy(delta):
pass
func exit_state():
pass
func time_out():
pass

View File

@ -2,11 +2,19 @@ extends State
var init_position:Vector2
var target_y:float=200
func enter_state(n):
var player:Card=get_player() as Card
player.move_to(player.position,player.get_queue_position())
init_position=n
get_player().open_arrow()
func update_state(delta):
if Input.is_action_just_released("mouse_left"):
change_to_state("selected_back")
var target=get_player().get_select_result()
if target!=null:
change_to_state("queue",target)
return
else:
change_to_state("selected_back")
return
return
if Input.is_action_just_pressed("mouse_right"):
change_to_state("selected_back")

View File

@ -11,16 +11,21 @@ func enter_state(n):
pass
func update_state(delta):
get_player().position=get_player().get_parent().get_local_mouse_position()
var change_y=(init_position-get_player().get_parent().get_local_mouse_position()).y
if Input.is_action_just_released("mouse_left"):
change_to_state("selected_back")
return
if change_y>target_y and not need_target:
change_to_state("queue",null)
return
else:
change_to_state("selected_back")
return
if Input.is_action_just_pressed("mouse_right"):
change_to_state("selected_back")
return
var change_y=(init_position-get_player().get_parent().get_local_mouse_position()).y
if need_target and change_y>target_y:
change_to_state("select_target",init_position)
return
pass
func update_state_phy(delta):
pass

View File

@ -1,18 +1,51 @@
extends Control
class_name FightScene
##角色节点的引用队列
var character_arr:Array[FightCharacterCard]=[]
var enermy_arr:Array[FightEnermyCard]=[]
var extract_card_arr:Array=[]
var hand_card_arr:Array=[]
var left_card_arr:Array=[]
var extract_num:int=5
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
extract_card_arr=Global.get_all_card()
extract_card(extract_num)
pass # Replace with function body.
func extract_card(num:int):
if extract_card_arr.size()<num:
refresh_card()
for i in num:
if extract_card_arr.size()==0:
break
var rand:int=randi()%extract_card_arr.size()
var id=extract_card_arr[rand]
extract_card_arr.pop_at(rand)
hand_card_arr.append(id)
%card_machine.add_card(id,1)
pass
func refresh_card():
extract_card_arr.append_array(left_card_arr.duplicate())
left_card_arr.clear()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func start_turn():
left_card_arr.append_array(hand_card_arr.duplicate())
hand_card_arr.clear()
await %card_machine.exe_queue()
extract_card(extract_num)
%end_select.show()
pass
func _on_tool_button_pressed() -> void:
%card_machine.add_card("card_01",1)
%card_machine.add_card("card_02",1)
%card_machine.add_card("card_03",1)
pass # Replace with function body.
func _on_end_select_pressed() -> void:
%card_machine.clear_card()
%end_select.hide()
start_turn()
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://sn3v7t7xjr1o"]
[gd_scene load_steps=14 format=3 uid="uid://sn3v7t7xjr1o"]
[ext_resource type="Script" path="res://scene/fight.gd" id="1_1e3ie"]
[ext_resource type="Texture2D" uid="uid://b1wfklbrwhh3y" path="res://res/ui/ui_025_adventure_mode/tuceng349.png" id="1_08haj"]
@ -7,8 +7,45 @@
[ext_resource type="PackedScene" uid="uid://b6t1mn3dd73ox" path="res://scene/card_state_machine/card_machine.tscn" id="4_i7vc5"]
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="5_cxbtq"]
[ext_resource type="PackedScene" uid="uid://braadtw2q0x6u" path="res://scene/fight_character_card.tscn" id="6_5ixhk"]
[ext_resource type="Shader" path="res://res/shader/stroke.gdshader" id="6_no4k5"]
[ext_resource type="PackedScene" uid="uid://dd4387syao6lj" path="res://scene/fight_enermy_card.tscn" id="7_fjnhq"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hr0jf"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 0.996078)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = false
shader_parameter/flashing_color = Color(0.851769, 0.851769, 0.851769, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ey3i6"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 0.996078)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = false
shader_parameter/flashing_color = Color(0.851769, 0.851769, 0.851769, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n2ued"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 1)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = null
shader_parameter/flashing_color = Color(1, 1, 1, 1)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_246ik"]
texture = ExtResource("1_yh6pq")
texture_margin_left = 49.247
@ -47,7 +84,8 @@ offset_bottom = -67.0
texture = ExtResource("4_3x8hl")
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="TextureRect" instance=ExtResource("5_cxbtq")]
[node name="end_select" parent="TextureRect" instance=ExtResource("5_cxbtq")]
unique_name_in_owner = true
layout_mode = 1
[node name="character_card_add_pos" type="HBoxContainer" parent="."]
@ -61,9 +99,11 @@ theme_override_constants/separation = 20
metadata/_edit_use_anchors_ = true
[node name="fight_character_card" parent="character_card_add_pos" instance=ExtResource("6_5ixhk")]
material = SubResource("ShaderMaterial_hr0jf")
layout_mode = 2
[node name="fight_character_card2" parent="character_card_add_pos" instance=ExtResource("6_5ixhk")]
material = SubResource("ShaderMaterial_ey3i6")
layout_mode = 2
[node name="enermy_card_add_pos" type="HBoxContainer" parent="."]
@ -77,6 +117,7 @@ alignment = 2
metadata/_edit_use_anchors_ = true
[node name="fight_enermy_card" parent="enermy_card_add_pos" instance=ExtResource("7_fjnhq")]
material = SubResource("ShaderMaterial_n2ued")
layout_mode = 2
[node name="Panel" type="Panel" parent="."]
@ -89,9 +130,11 @@ anchor_bottom = 0.960185
theme_override_styles/panel = SubResource("StyleBoxTexture_246ik")
metadata/_edit_use_anchors_ = true
[node name="card_machine" parent="Panel" instance=ExtResource("4_i7vc5")]
[node name="card_machine" parent="Panel" node_paths=PackedStringArray("release_card_pos", "exe_card_pos") instance=ExtResource("4_i7vc5")]
unique_name_in_owner = true
layout_mode = 1
release_card_pos = NodePath("../../release_mark")
exe_card_pos = NodePath("../../exe_mark")
[node name="Label" type="Label" parent="."]
layout_mode = 0
@ -104,4 +147,23 @@ vertical_alignment = 1
[node name="ToolButton" parent="Label" instance=ExtResource("5_cxbtq")]
layout_mode = 1
[node name="release_mark" type="Control" parent="."]
layout_mode = 1
anchor_left = 0.059375
anchor_top = 0.337037
anchor_right = 0.0802083
anchor_bottom = 0.374074
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="exe_mark" type="Control" parent="."]
layout_mode = 1
anchor_left = 0.755208
anchor_top = 0.39537
anchor_right = 0.776042
anchor_bottom = 0.432407
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[connection signal="pressed" from="TextureRect/end_select" to="." method="_on_end_select_pressed"]
[connection signal="pressed" from="Label/ToolButton" to="." method="_on_tool_button_pressed"]

View File

@ -1,4 +1,14 @@
extends TextureRect
class_name FightCharacterCard
@onready var n: Label = $TextureRect/n
@onready var icon: TextureRect = $TextureRect/TextureRect2/icon
func _on_area_2d_area_entered(area: Area2D) -> void:
material.set_shader_parameter("width",10)
pass # Replace with function body.
func _on_area_2d_area_exited(area: Area2D) -> void:
material.set_shader_parameter("width",0)
pass # Replace with function body.

View File

@ -1,5 +1,6 @@
[gd_scene load_steps=10 format=3 uid="uid://braadtw2q0x6u"]
[gd_scene load_steps=12 format=3 uid="uid://braadtw2q0x6u"]
[ext_resource type="Shader" path="res://res/shader/stroke.gdshader" id="1_7tjg7"]
[ext_resource type="Texture2D" uid="uid://cn2q8k4s3bxiu" path="res://res/ui/ui_026_fight/juxing744_1.png" id="1_oi31c"]
[ext_resource type="Script" path="res://scene/fight_character_card.gd" id="2_berqc"]
[ext_resource type="Texture2D" uid="uid://by6vl56taeyd2" path="res://res/ui/ui_026_fight/tuceng285_2.png" id="2_evh5s"]
@ -9,10 +10,23 @@
[ext_resource type="Texture2D" uid="uid://deecs52usa3ie" path="res://res/ui/ui_026_fight/juxing768_1.png" id="6_j0vci"]
[ext_resource type="Texture2D" uid="uid://dupfisl50axgw" path="res://res/ui/ui_026_fight/juxing768_2.png" id="7_wx32q"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tpy32"]
resource_local_to_scene = true
shader = ExtResource("1_7tjg7")
shader_parameter/color = Color(0, 0, 0, 0.996078)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = false
shader_parameter/flashing_color = Color(0.851769, 0.851769, 0.851769, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_oitb8"]
size = Vector2(457, 252)
[node name="fight_character_card" type="TextureRect"]
material = SubResource("ShaderMaterial_tpy32")
offset_right = 450.0
offset_bottom = 250.0
size_flags_horizontal = 0
@ -22,6 +36,7 @@ expand_mode = 3
script = ExtResource("2_berqc")
[node name="TextureRect" type="TextureRect" parent="."]
use_parent_material = true
layout_mode = 1
anchors_preset = -1
anchor_right = 0.42
@ -174,3 +189,6 @@ vertical_alignment = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(224.5, 124)
shape = SubResource("RectangleShape2D_oitb8")
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]

View File

@ -0,0 +1,20 @@
extends TextureRect
class_name FightEnermyCard
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_area_2d_area_entered(area: Area2D) -> void:
material.set_shader_parameter("width",10)
pass # Replace with function body.
func _on_area_2d_area_exited(area: Area2D) -> void:
material.set_shader_parameter("width",0)
pass # Replace with function body.

View File

@ -1,25 +1,42 @@
[gd_scene load_steps=9 format=3 uid="uid://dd4387syao6lj"]
[gd_scene load_steps=12 format=3 uid="uid://dd4387syao6lj"]
[ext_resource type="Texture2D" uid="uid://clmrqr17vnoda" path="res://res/ui/ui_026_fight/juxing804.png" id="1_c6q2o"]
[ext_resource type="Shader" path="res://res/shader/stroke.gdshader" id="1_r723e"]
[ext_resource type="Texture2D" uid="uid://lipjl5h1d776" path="res://res/ui/ui_026_fight/tuceng285_1.png" id="2_ac0qe"]
[ext_resource type="Script" path="res://scene/fight_enermy_card.gd" id="2_lqjer"]
[ext_resource type="Texture2D" uid="uid://d4geq35efgqon" path="res://res/ui/ui_026_fight/tuceng286.png" id="3_s8rrj"]
[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="4_u7od8"]
[ext_resource type="Texture2D" uid="uid://bvhrxkcpq3lco" path="res://res/ui/ui_026_fight/juxing768.png" id="5_0j5x7"]
[ext_resource type="Texture2D" uid="uid://deecs52usa3ie" path="res://res/ui/ui_026_fight/juxing768_1.png" id="6_x31v6"]
[ext_resource type="Texture2D" uid="uid://dupfisl50axgw" path="res://res/ui/ui_026_fight/juxing768_2.png" id="7_4wsqq"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4ic87"]
resource_local_to_scene = true
shader = ExtResource("1_r723e")
shader_parameter/color = Color(0, 0, 0, 1)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = null
shader_parameter/flashing_color = Color(1, 1, 1, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ut4q5"]
size = Vector2(453, 249)
[node name="fight_enermy_card" type="TextureRect"]
material = SubResource("ShaderMaterial_4ic87")
offset_right = 450.0
offset_bottom = 250.0
size_flags_horizontal = 8
size_flags_vertical = 3
texture = ExtResource("1_c6q2o")
expand_mode = 3
script = ExtResource("2_lqjer")
[node name="TextureRect" type="TextureRect" parent="."]
use_parent_material = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.573333
@ -170,7 +187,12 @@ horizontal_alignment = 1
vertical_alignment = 1
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(226.5, 125.5)
shape = SubResource("RectangleShape2D_ut4q5")
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]

View File

@ -31,7 +31,6 @@ func judge():
self.show()
else:
self.hide()
print(data["name"]+"判定结果:"+str(res))
func _on_tool_button_pressed() -> void:
pass # Replace with function body.