Compare commits

...

7 Commits

10 changed files with 263 additions and 267 deletions

View File

@ -9,12 +9,18 @@
config_version=4 config_version=4
_global_script_classes=[ { _global_script_classes=[ {
"base": "Node",
"class": "BaseMove",
"language": "GDScript",
"path": "res://src/nodes/moves/BaseMove.gd"
}, {
"base": "Node2D", "base": "Node2D",
"class": "Unit", "class": "Unit",
"language": "GDScript", "language": "GDScript",
"path": "res://src/classes/Unit.gd" "path": "res://src/classes/Unit.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"BaseMove": "",
"Unit": "" "Unit": ""
} }

Binary file not shown.

View File

@ -77,7 +77,9 @@ func move(movement : Vector2):
if (potential_movement[2] == false): #not behind if (potential_movement[2] == false): #not behind
z_index = 100 z_index = 100
$UnitPopup.get_node("PopupMenu").popup() yield(get_tree().create_timer(.3), "timeout")
var popup = $Canvas/UnitPopup
popup.popup(Rect2(position.x + 0, position.y - 110, popup.rect_size.x, popup.rect_size.x))
func attack(damage : int, points : int, pattern : PoolVector2Array): func attack(damage : int, points : int, pattern : PoolVector2Array):
@ -113,3 +115,16 @@ func _physics_process(delta: float) -> void:
emit_signal("turn_completed") emit_signal("turn_completed")
_has_sent_turn_completed = true _has_sent_turn_completed = true
func _on_move_selected(move_num) -> void:
#get move properties TODO
var target_move = get_node(("Move" + move_num))
var move_name = target_move.getName()
var move_damage = target_move.getDamage()
var move_points = target_move.getPoints()
var move_pattern = target_move.getPattern()
#run attack function
attack(move_damage, move_points, move_pattern)

139
src/classes/Unit.tscn Normal file
View File

@ -0,0 +1,139 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://src/classes/Unit.gd" type="Script" id=1]
[ext_resource path="res://src/assets/shadow.png" type="Texture" id=2]
[ext_resource path="res://src/nodes/UI/UnitPopup.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
resource_name = "Attack back"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacked back"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacked front"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=5]
length = 0.9
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.9
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Unit" type="Node2D"]
z_index = 100
script = ExtResource( 1 )
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
"anims/Attacked back" = SubResource( 4 )
"anims/Attacked front" = SubResource( 3 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )
[node name="Canvas" type="CanvasLayer" parent="."]
[node name="UnitPopup" parent="Canvas" instance=ExtResource( 3 )]
margin_right = 40.0
margin_bottom = 88.0
[connection signal="move_selected" from="Canvas/UnitPopup" to="." method="_on_move_selected"]

View File

@ -0,0 +1,8 @@
extends PopupPanel
signal move_selected(move_num)
func _move_selected(move_num: int) -> void:
print(move_num)
hide()
emit_signal("move_selected", move_num)

View File

@ -1,13 +1,71 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/assets/theme.theme" type="Theme" id=1] [ext_resource path="res://src/assets/theme.theme" type="Theme" id=1]
[ext_resource path="res://src/nodes/UI/UnitPopup.gd" type="Script" id=2]
[node name="UnitPopup" type="Control"] [node name="PopupMenu" type="PopupPanel"]
margin_right = 20.0 margin_right = 39.0
margin_bottom = 20.0 margin_bottom = 97.0
theme = ExtResource( 1 ) theme = ExtResource( 1 )
script = ExtResource( 2 )
[node name="PopupMenu" type="PopupMenu" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 20.0 anchor_left = 0.5
margin_bottom = 20.0 anchor_top = 0.5
items = [ "Move 1", null, 0, false, false, 0, 0, null, "", false, "Move 2", null, 0, false, false, 1, 0, null, "", false, "Move 3", null, 0, false, false, 2, 0, null, "", false, "Move 4", null, 0, false, false, 3, 0, null, "", false, "Move 5", null, 0, false, false, 4, 0, null, "", false ] anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -16.0
margin_top = -44.5
margin_right = 16.0
margin_bottom = 44.5
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer"]
margin_top = 4.0
margin_right = 32.0
margin_bottom = 12.0
text = "Health"
align = 1
[node name="Label2" type="Label" parent="VBoxContainer"]
margin_top = 16.0
margin_right = 32.0
margin_bottom = 24.0
text = "Damage"
align = 1
[node name="Move0" type="Button" parent="VBoxContainer"]
margin_top = 76.0
margin_right = 32.0
margin_bottom = 84.0
text = "Move 0"
[node name="Move1" type="Button" parent="VBoxContainer"]
margin_top = 28.0
margin_right = 32.0
margin_bottom = 36.0
text = "Move 1"
[node name="Move2" type="Button" parent="VBoxContainer"]
margin_top = 40.0
margin_right = 32.0
margin_bottom = 48.0
text = "Move 2"
[node name="Move3" type="Button" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 32.0
margin_bottom = 60.0
text = "Move 3"
[node name="Move4" type="Button" parent="VBoxContainer"]
margin_top = 64.0
margin_right = 32.0
margin_bottom = 72.0
text = "Move 4"
[connection signal="pressed" from="VBoxContainer/Move0" to="." method="_move_selected" binds= [ 0 ]]
[connection signal="pressed" from="VBoxContainer/Move1" to="." method="_move_selected" binds= [ 1 ]]
[connection signal="pressed" from="VBoxContainer/Move2" to="." method="_move_selected" binds= [ 2 ]]
[connection signal="pressed" from="VBoxContainer/Move3" to="." method="_move_selected" binds= [ 3 ]]
[connection signal="pressed" from="VBoxContainer/Move4" to="." method="_move_selected" binds= [ 4 ]]

View File

@ -0,0 +1,16 @@
extends Node
class_name BaseMove
export var title : String = "Move"
export var power : int = 0
export (String,
"Normal", "Fire", "Water",
"Grass", "Sound") var type : String = "Normal" #TODEC
export (int, "Physical", "Special", "Status") var catagory : int #TODEC
export var accuracy : int = 100 #TODEC
export var makes_contact : bool = false #TODEC
export var points : int = 3
export var effect1 : String
export var effect2 : String
export var effect3 : String
export (String, MULTILINE) var description : String

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/nodes/moves/BaseMove.gd" type="Script" id=1]
[node name="BaseMove" type="Node"]
script = ExtResource( 1 )

View File

@ -1,134 +1,8 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/assets/shadow.png" type="Texture" id=1] [ext_resource path="res://src/classes/Unit.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/nodes/units/Foe.gd" type="Script" id=2] [ext_resource path="res://src/nodes/units/Foe.gd" type="Script" id=2]
[sub_resource type="Animation" id=1] [node name="Foe" groups=["foes"] instance=ExtResource( 1 )]
resource_name = "Attack back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacked front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacked back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=5]
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Foe" type="Node2D" groups=[
"foes",
]]
script = ExtResource( 2 ) script = ExtResource( 2 )
unit_type = "Foe" unit_type = "Foe"
movement_distance = 0
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
frame = 12
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
"anims/Attacked front" = SubResource( 3 )
"anims/Attacked back" = SubResource( 4 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )

View File

@ -1,134 +1,8 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/nodes/UI/UnitPopup.tscn" type="PackedScene" id=1] [ext_resource path="res://src/classes/Unit.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/assets/shadow.png" type="Texture" id=2]
[ext_resource path="res://src/nodes/units/Friend.gd" type="Script" id=3] [ext_resource path="res://src/nodes/units/Friend.gd" type="Script" id=3]
[sub_resource type="Animation" id=1] [node name="Friend" groups=["friends"] instance=ExtResource( 1 )]
resource_name = "Attack back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacked back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacked front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=5]
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Friend" type="Node2D" groups=["friends"]]
z_index = 100
script = ExtResource( 3 ) script = ExtResource( 3 )
unit_type = "Friend" unit_type = "Friend"
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
"anims/Attacked back" = SubResource( 4 )
"anims/Attacked front" = SubResource( 3 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )
[node name="UnitPopup" parent="." instance=ExtResource( 1 )]