Merge pull request #324 from talklittle/role-playing-game-3.1

Port 2d/role_playing_game to Godot 3.1
This commit is contained in:
Aaron Franke
2020-01-23 00:23:47 -05:00
committed by GitHub
42 changed files with 85 additions and 653 deletions

View File

@@ -11,7 +11,7 @@ func _ready():
combat_screen = get_node(combat_screen)
combat_screen.connect("combat_finished", self, "_on_combat_finished")
for n in $Exploration/Grid.get_children():
if not n.type == n.CELL_TYPES.ACTOR:
if not n.type == n.CellType.ACTOR:
continue
if not n.has_node("DialoguePlayer"):
continue
@@ -35,7 +35,7 @@ func start_combat(combat_actors):
combat_screen.initialize(combat_actors)
$AnimationPlayer.play_backwards("fade")
func _on_combat_finished(winner, loser):
func _on_combat_finished(winner, _loser):
remove_child(combat_screen)
$AnimationPlayer.play_backwards("fade")
add_child(exploration_screen)

View File

@@ -3,8 +3,5 @@
[ext_resource path="res://dialogue/dialogue_player/DialoguePlayer.gd" type="Script" id=1]
[node name="DialoguePlayer" type="Node"]
script = ExtResource( 1 )
dialogue_file = null

View File

@@ -3,106 +3,33 @@
[ext_resource path="res://theme/theme.tres" type="Theme" id=1]
[ext_resource path="res://dialogue/interface/Interface.gd" type="Script" id=2]
[node name="Dialogue" type="Panel"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 544.0
margin_right = 1280.0
margin_bottom = 720.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
theme = ExtResource( 1 )
script = ExtResource( 2 )
[node name="Name" type="RichTextLabel" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Name" type="RichTextLabel" parent="."]
margin_left = 40.0
margin_top = 16.0
margin_right = 1072.0
margin_bottom = 56.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
bbcode_enabled = false
bbcode_text = ""
visible_characters = -1
percent_visible = 1.0
meta_underlined = true
tab_size = 4
text = "Name"
scroll_active = false
scroll_following = false
selection_enabled = false
override_selected_font_color = false
[node name="Text" type="RichTextLabel" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Text" type="RichTextLabel" parent="."]
margin_left = 40.0
margin_top = 64.0
margin_right = 1064.0
margin_bottom = 152.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
bbcode_enabled = false
bbcode_text = ""
visible_characters = -1
percent_visible = 1.0
meta_underlined = true
tab_size = 4
text = "Dialogue Text"
scroll_active = true
scroll_following = false
selection_enabled = false
override_selected_font_color = false
[node name="Button" type="Button" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Button" type="Button" parent="."]
margin_left = 1104.0
margin_top = 32.0
margin_right = 1264.0
margin_bottom = 151.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Next"
flat = false
align = 1
[connection signal="button_up" from="Button" to="." method="_on_Button_button_up"]

View File

@@ -1,6 +1,6 @@
extends TileMap
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
enum CellType { ACTOR, OBSTACLE, OBJECT }
export(NodePath) var dialogue_ui
func _ready():
@@ -8,7 +8,7 @@ func _ready():
set_cellv(world_to_map(child.position), child.type)
func get_cell_pawn(cell, type = CELL_TYPES.ACTOR):
func get_cell_pawn(cell, type = CellType.ACTOR):
for node in get_children():
if node.type != type:
continue
@@ -23,10 +23,10 @@ func request_move(pawn, direction):
var cell_tile_id = get_cellv(cell_target)
match cell_tile_id:
-1:
set_cellv(cell_target, CELL_TYPES.ACTOR)
set_cellv(cell_target, CellType.ACTOR)
set_cellv(cell_start, -1)
return map_to_world(cell_target) + cell_size / 2
CELL_TYPES.OBJECT, CELL_TYPES.ACTOR:
CellType.OBJECT, CellType.ACTOR:
var target_pawn = get_cell_pawn(cell_target, cell_tile_id)
print("Cell %s contains %s" % [cell_target, target_pawn.name])

View File

@@ -1,4 +1,4 @@
extends 'pawn.gd'
extends 'Pawn.gd'
onready var Grid = get_parent()
var lost = false
@@ -35,9 +35,9 @@ func move_to(target_position):
$Tween.interpolate_property($Pivot, "position", move_direction * 32, Vector2(), $AnimationPlayer.current_animation_length, Tween.TRANS_LINEAR, Tween.EASE_IN)
$Pivot/Sprite.position = position - target_position
position = target_position
yield($AnimationPlayer, "animation_finished")
set_process(true)
func bump():

39
2d/role_playing_game/grid_movement/pawns/Actor.tscn Executable file → Normal file
View File

@@ -1,13 +1,11 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://grid_movement/pawns/actor.gd" type="Script" id=1]
[ext_resource path="res://grid_movement/pawns/Actor.gd" type="Script" id=1]
[ext_resource path="res://grid_movement/pawns/character.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "bump"
length = 0.1
loop = false
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:position")
@@ -23,10 +21,8 @@ tracks/0/keys = {
}
[sub_resource type="Animation" id=2]
resource_name = "walk"
length = 0.25
loop = false
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:self_modulate")
@@ -65,47 +61,24 @@ tracks/2/keys = {
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ]
}
[node name="Actor" type="Node2D" index="0"]
[node name="Actor" type="Node2D"]
position = Vector2( 32, 32 )
z_index = 1
script = ExtResource( 1 )
_sections_unfolded = [ "Offset", "Transform", "Z Index" ]
__meta__ = {
"_edit_group_": true
}
type = 0
combat_actor = null
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/bump = SubResource( 1 )
anims/walk = SubResource( 2 )
blend_times = [ ]
[node name="Tween" type="Tween" parent="." index="1"]
[node name="Tween" type="Tween" parent="."]
repeat = false
playback_process_mode = 1
playback_speed = 1.0
playback/active = false
playback/repeat = false
playback/speed = 1.0
[node name="Pivot" type="Position2D" parent="." index="2"]
_sections_unfolded = [ "Transform" ]
[node name="Sprite" type="Sprite" parent="Pivot" index="0"]
[node name="Pivot" type="Position2D" parent="."]
[node name="Sprite" type="Sprite" parent="Pivot"]
texture = ExtResource( 2 )
centered = false
offset = Vector2( -32, -32 )
_sections_unfolded = [ "Transform", "Visibility" ]

View File

@@ -3,14 +3,9 @@
[ext_resource path="res://grid_movement/pawns/Walker.gd" type="Script" id=1]
[ext_resource path="res://grid_movement/pawns/sprite.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "bump"
length = 0.1
loop = false
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:position")
@@ -26,10 +21,8 @@ tracks/0/keys = {
}
[sub_resource type="Animation" id=2]
resource_name = "walk"
length = 0.25
loop = false
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Sprite:self_modulate")
@@ -69,46 +62,26 @@ tracks/2/keys = {
}
[node name="Actor" type="Node2D"]
position = Vector2( 32, 32 )
z_index = 1
script = ExtResource( 1 )
_sections_unfolded = [ "Offset", "Transform", "Z Index" ]
__meta__ = {
"_edit_group_": true
}
_sections_unfolded = [ "Offset", "Transform", "Z Index" ]
type = 0
combat_actor = null
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/bump = SubResource( 1 )
anims/walk = SubResource( 2 )
blend_times = [ ]
[node name="Tween" type="Tween" parent="." index="1"]
[node name="Tween" type="Tween" parent="."]
repeat = false
playback_process_mode = 1
playback_speed = 1.0
playback/active = false
playback/repeat = false
playback/speed = 1.0
[node name="Pivot" type="Position2D" parent="." index="2"]
_sections_unfolded = [ "Transform" ]
[node name="Sprite" type="Sprite" parent="Pivot" index="0"]
[node name="Pivot" type="Position2D" parent="."]
[node name="Sprite" type="Sprite" parent="Pivot"]
texture = ExtResource( 2 )
centered = false
offset = Vector2( -32, -32 )
_sections_unfolded = [ "Transform", "Visibility" ]

View File

@@ -1,7 +1,7 @@
extends Node2D
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
export(CELL_TYPES) var type = CELL_TYPES.ACTOR
enum CellType { ACTOR, OBSTACLE, OBJECT }
export(CellType) var type = CellType.ACTOR
var active = true setget set_active

View File

@@ -7,7 +7,7 @@ var lost = false
func _ready():
update_look_direction(Vector2(1, 0))
func _process(delta):
func _process(_delta):
var input_direction = get_input_direction()
if not input_direction:
return

View File

View File

@@ -4,25 +4,17 @@
[ext_resource path="res://grid_movement/tilesets/grid/obstacle.png" type="Texture" id=2]
[ext_resource path="res://grid_movement/tilesets/grid/object.png" type="Texture" id=3]
[node name="Node2D" type="Node2D"]
[node name="Actor" type="Sprite" parent="." index="0"]
[node name="Actor" type="Sprite" parent="."]
position = Vector2( 32, 32 )
texture = ExtResource( 1 )
_sections_unfolded = [ "Visibility" ]
[node name="Obstacle" type="Sprite" parent="." index="1"]
[node name="Obstacle" type="Sprite" parent="."]
position = Vector2( 96, 32 )
texture = ExtResource( 2 )
_sections_unfolded = [ "Visibility" ]
[node name="Object" type="Sprite" parent="." index="2"]
[node name="Object" type="Sprite" parent="."]
position = Vector2( 160, 32 )
texture = ExtResource( 3 )
_sections_unfolded = [ "Visibility" ]

View File

View File

View File

View File

@@ -2,12 +2,9 @@
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
[node name="TileSet" type="Node2D"]
[node name="TileSet" type="Node2D" index="0"]
[node name="Grass" type="Sprite" parent="." index="0"]
[node name="Grass" type="Sprite" parent="."]
position = Vector2( 32, 32 )
texture = ExtResource( 1 )

0
2d/role_playing_game/project.godot Executable file → Normal file
View File

View File

@@ -7,7 +7,6 @@
[ext_resource path="res://screens/combat/interface/Info.tscn" type="PackedScene" id=5]
[sub_resource type="GDScript" id=1]
script/source = "extends Node2D
func add_combatant(new_combatant):
@@ -16,170 +15,67 @@ func add_combatant(new_combatant):
"
[node name="Combat" type="Node2D"]
script = ExtResource( 1 )
[node name="Combatants" type="Node2D" parent="." index="0"]
[node name="Combatants" type="Node2D" parent="."]
position = Vector2( 539, 275 )
script = SubResource( 1 )
_sections_unfolded = [ "Transform" ]
[node name="TurnQueue" parent="." index="1" instance=ExtResource( 2 )]
[node name="TurnQueue" parent="." instance=ExtResource( 2 )]
combatants_list = NodePath("../Combatants")
[node name="UI" type="Control" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="UI" type="Control" parent="."]
margin_right = 1280.0
margin_bottom = 720.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
theme = ExtResource( 3 )
script = ExtResource( 4 )
_sections_unfolded = [ "Theme" ]
combatants_node = NodePath("../Combatants")
info_scene = ExtResource( 5 )
[node name="Combatants" type="HBoxContainer" parent="UI" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Combatants" type="HBoxContainer" parent="UI"]
margin_top = 77.0
margin_right = 1280.0
margin_bottom = 328.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_constants/separation = 360
alignment = 0
_sections_unfolded = [ "custom_constants" ]
[node name="Buttons" type="PanelContainer" parent="UI" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Buttons" type="PanelContainer" parent="UI"]
margin_left = 80.0
margin_top = 376.0
margin_right = 1200.0
margin_bottom = 698.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
_sections_unfolded = [ "Theme" ]
[node name="GridContainer" type="GridContainer" parent="UI/Buttons" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="GridContainer" type="GridContainer" parent="UI/Buttons"]
margin_left = 90.0
margin_top = 35.0
margin_right = 1030.0
margin_bottom = 277.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
_sections_unfolded = [ "Size Flags" ]
[node name="Attack" type="Button" parent="UI/Buttons/GridContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Attack" type="Button" parent="UI/Buttons/GridContainer"]
margin_right = 468.0
margin_bottom = 121.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Attack"
flat = false
align = 1
[node name="Defend" type="Button" parent="UI/Buttons/GridContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Defend" type="Button" parent="UI/Buttons/GridContainer"]
margin_left = 472.0
margin_right = 940.0
margin_bottom = 121.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Defend"
flat = false
align = 1
[node name="Flee" type="Button" parent="UI/Buttons/GridContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Flee" type="Button" parent="UI/Buttons/GridContainer"]
margin_top = 125.0
margin_right = 468.0
margin_bottom = 246.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Flee"
flat = false
align = 1
[connection signal="button_up" from="UI/Buttons/GridContainer/Attack" to="UI" method="_on_Attack_button_up"]
[connection signal="button_up" from="UI/Buttons/GridContainer/Defend" to="UI" method="_on_Defend_button_up"]
[connection signal="button_up" from="UI/Buttons/GridContainer/Flee" to="UI" method="_on_Flee_button_up"]

15
2d/role_playing_game/screens/combat/actors/Actor.tscn Executable file → Normal file
View File

@@ -1,20 +1,15 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://turn_combat_system/actors/Actor.gd" type="Script" id=1]
[ext_resource path="res://turn_combat_system/actors/health/Health.tscn" type="PackedScene" id=2]
[ext_resource path="res://turn_combat/combatants/Combatant.gd" type="Script" id=1]
[ext_resource path="res://turn_combat/combatants/health/Health.tscn" type="PackedScene" id=2]
[ext_resource path="res://screens/combat/actors/sprites/Sprite.tscn" type="PackedScene" id=3]
[node name="Actor" type="Node2D" index="0"]
[node name="Actor" type="Node2D"]
script = ExtResource( 1 )
damage = 2
defense = 1
[node name="Health" parent="." index="0" instance=ExtResource( 2 )]
[node name="Health" parent="." instance=ExtResource( 2 )]
life = 10
armor = 2
[node name="Sprite" type="Node2D" parent="." index="1" instance=ExtResource( 3 )]
[node name="Sprite" parent="." instance=ExtResource( 3 )]

View File

@@ -4,8 +4,7 @@
[ext_resource path="res://screens/combat/actors/sprites/green.png" type="Texture" id=2]
[sub_resource type="GDScript" id=1]
script/source = "extends \"res://turn_combat_system/actors/Actor.gd\"
script/source = "extends \"res://turn_combat/combatants/Combatant.gd\"
func set_active(value):
.set_active(value)
@@ -22,28 +21,20 @@ func set_active(value):
attack(target)"
[node name="Opponent" instance=ExtResource( 1 )]
script = SubResource( 1 )
_sections_unfolded = [ "Transform" ]
damage = 3
defense = 0
[node name="Health" parent="." index="0"]
life = 7
max_life = 7
armor = 1
[node name="Body" parent="Sprite/Pivot" index="1"]
texture = ExtResource( 2 )
[node name="Timer" type="Timer" parent="." index="2"]
process_mode = 1
wait_time = 0.25
one_shot = true
autostart = false
[editable path="Sprite"]

7
2d/role_playing_game/screens/combat/actors/Player.tscn Executable file → Normal file
View File

@@ -3,12 +3,5 @@
[ext_resource path="res://screens/combat/actors/Actor.tscn" type="PackedScene" id=1]
[node name="Player" instance=ExtResource( 1 )]
_sections_unfolded = [ "Transform" ]
defense = 2
[node name="Health" parent="." index="0"]
armor = 0

View File

@@ -3,12 +3,9 @@
[ext_resource path="res://screens/combat/actors/sprites/shadow.png" type="Texture" id=1]
[ext_resource path="res://screens/combat/actors/sprites/blue.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "take_damage"
length = 0.2
loop = false
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Body:modulate")
@@ -25,37 +22,18 @@ tracks/0/keys = {
[node name="Sprite" type="Node2D"]
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/take_damage = SubResource( 1 )
blend_times = [ ]
[node name="Tween" type="Tween" parent="." index="1"]
[node name="Tween" type="Tween" parent="."]
repeat = false
playback_process_mode = 1
playback_speed = 1.0
playback/active = false
playback/repeat = false
playback/speed = 1.0
[node name="Pivot" type="Position2D" parent="." index="2"]
[node name="Shadow" type="Sprite" parent="Pivot" index="0"]
[node name="Pivot" type="Position2D" parent="."]
[node name="Shadow" type="Sprite" parent="Pivot"]
position = Vector2( 0, -15 )
texture = ExtResource( 1 )
_sections_unfolded = [ "Transform" ]
[node name="Body" type="Sprite" parent="Pivot" index="1"]
[node name="Body" type="Sprite" parent="Pivot"]
position = Vector2( 0, -76 )
texture = ExtResource( 2 )
_sections_unfolded = [ "Visibility" ]

View File

View File

View File

View File

@@ -3,70 +3,32 @@
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=1]
[node name="ActorInfo" type="PanelContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 409.0
margin_bottom = 239.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VBoxContainer" type="VBoxContainer" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 402.0
margin_bottom = 232.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="Name" parent="VBoxContainer" index="0" instance=ExtResource( 1 )]
[node name="Name" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 395.0
margin_bottom = 110.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "{name}"
_sections_unfolded = [ "Rect", "Size Flags", "custom_colors", "custom_constants", "custom_fonts" ]
[node name="Health" type="ProgressBar" parent="VBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 161.0
[node name="Health" type="ProgressBar" parent="VBoxContainer"]
margin_top = 168.0
margin_right = 395.0
margin_bottom = 177.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
margin_bottom = 170.0
size_flags_vertical = 6
min_value = 0.0
max_value = 10.0
step = 1.0
page = 0.0
value = 5.0
exp_edit = false
rounded = true
percent_visible = false
_sections_unfolded = [ "Percent", "Size Flags" ]

View File

@@ -3,70 +3,32 @@
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=1]
[node name="Info" type="PanelContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 409.0
margin_bottom = 239.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VBoxContainer" type="VBoxContainer" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0
margin_top = 7.0
margin_right = 402.0
margin_bottom = 232.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="Name" parent="VBoxContainer" index="0" instance=ExtResource( 1 )]
[node name="Name" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 395.0
margin_bottom = 110.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "{name}"
_sections_unfolded = [ "Rect", "Size Flags", "custom_colors", "custom_constants", "custom_fonts" ]
[node name="Health" type="ProgressBar" parent="VBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 161.0
[node name="Health" type="ProgressBar" parent="VBoxContainer"]
margin_top = 168.0
margin_right = 395.0
margin_bottom = 177.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
margin_bottom = 170.0
size_flags_vertical = 6
min_value = 0.0
max_value = 10.0
step = 1.0
page = 0.0
value = 5.0
exp_edit = false
rounded = true
percent_visible = false
_sections_unfolded = [ "Percent", "Size Flags" ]

165
2d/role_playing_game/theme/Theme.tscn Executable file → Normal file
View File

@@ -7,7 +7,6 @@
[ext_resource path="res://theme/progressbar/foreground_stylebox_blue.tres" type="StyleBox" id=5]
[sub_resource type="GDScript" id=1]
script/source = "extends VBoxContainer
func _ready():
@@ -27,208 +26,76 @@ func _on_Button_button_up():
set_process(false)
"
[node name="Control" type="Control" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Control" type="Control"]
margin_right = 1024.0
margin_bottom = 600.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
theme = ExtResource( 1 )
_sections_unfolded = [ "Size Flags", "Theme" ]
[node name="Panel" type="Panel" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Panel" type="Panel" parent="."]
margin_left = 128.0
margin_top = 64.0
margin_right = 896.0
margin_bottom = 536.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
_sections_unfolded = [ "Rect" ]
[node name="Title" parent="Panel" index="0" instance=ExtResource( 2 )]
[node name="Title" parent="Panel" instance=ExtResource( 2 )]
margin_right = 767.0
[node name="VBoxContainer" type="VBoxContainer" parent="Panel" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
margin_left = 128.0
margin_top = 180.0
margin_right = 524.0
margin_bottom = 424.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 5
alignment = 0
script = SubResource( 1 )
_sections_unfolded = [ "custom_constants" ]
[node name="Speed" type="Label" parent="Panel/VBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Speed" type="Label" parent="Panel/VBoxContainer"]
margin_right = 396.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
custom_fonts/font = ExtResource( 3 )
text = "Speed"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts" ]
[node name="ProgressBarRed" type="ProgressBar" parent="Panel/VBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="ProgressBarRed" type="ProgressBar" parent="Panel/VBoxContainer"]
margin_top = 45.0
margin_right = 396.0
margin_bottom = 109.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 0
margin_bottom = 85.0
custom_styles/fg = ExtResource( 4 )
min_value = 0.0
max_value = 100.0
step = 1.0
page = 0.0
value = 0.0
exp_edit = false
rounded = false
percent_visible = false
_sections_unfolded = [ "Percent", "custom_styles" ]
[node name="BlankSpace" type="ReferenceRect" parent="Panel/VBoxContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 114.0
[node name="BlankSpace" type="ReferenceRect" parent="Panel/VBoxContainer"]
margin_top = 90.0
margin_right = 396.0
margin_bottom = 130.0
margin_bottom = 154.0
rect_min_size = Vector2( 0, 16 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
_sections_unfolded = [ "Rect", "Size Flags" ]
[node name="Acceleration" type="Label" parent="Panel/VBoxContainer" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 135.0
[node name="Acceleration" type="Label" parent="Panel/VBoxContainer"]
margin_top = 159.0
margin_right = 396.0
margin_bottom = 175.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
margin_bottom = 199.0
custom_fonts/font = ExtResource( 3 )
text = "Acceleration"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors" ]
[node name="ProgressBarBlue" type="ProgressBar" parent="Panel/VBoxContainer" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 180.0
[node name="ProgressBarBlue" type="ProgressBar" parent="Panel/VBoxContainer"]
margin_top = 204.0
margin_right = 396.0
margin_bottom = 244.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 0
custom_styles/fg = ExtResource( 5 )
min_value = 0.0
max_value = 100.0
step = 1.0
page = 0.0
value = 0.0
exp_edit = false
rounded = false
percent_visible = false
_sections_unfolded = [ "Percent", "custom_styles" ]
[node name="Button" type="Button" parent="Panel" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Button" type="Button" parent="Panel"]
margin_left = 531.0
margin_top = 258.0
margin_right = 664.0
margin_bottom = 377.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 4
size_flags_stretch_ratio = 0.0
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Add"
flat = false
align = 1
_sections_unfolded = [ "Size Flags" ]
[connection signal="button_down" from="Panel/Button" to="Panel/VBoxContainer" method="_on_Button_button_down"]
[connection signal="button_up" from="Panel/Button" to="Panel/VBoxContainer" method="_on_Button_button_up"]

View File

View File

16
2d/role_playing_game/theme/labels/Title.tscn Executable file → Normal file
View File

@@ -3,19 +3,8 @@
[ext_resource path="res://theme/fonts/montserrat_extra_bold_48.tres" type="DynamicFont" id=1]
[node name="Title" type="Label"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 113.0
margin_bottom = 60.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_shadow = Color( 1, 0.596078, 0, 1 )
@@ -24,9 +13,4 @@ text = "Title"
align = 1
autowrap = true
clip_text = true
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Rect", "custom_colors", "custom_constants", "custom_fonts" ]

0
2d/role_playing_game/theme/panel/panel_rect.png.import Executable file → Normal file
View File

View File

View File

View File

View File

@@ -4,18 +4,12 @@
[ext_resource path="res://turn_combat/combatants/health/Health.tscn" type="PackedScene" id=2]
[ext_resource path="res://turn_combat/combatants/sprites/Sprite.tscn" type="PackedScene" id=3]
[node name="Combatant" type="Node2D"]
script = ExtResource( 1 )
damage = 2
defense = 1
[node name="Health" parent="." index="0" instance=ExtResource( 2 )]
[node name="Health" parent="." instance=ExtResource( 2 )]
life = 10
base_armor = 0
[node name="Sprite" parent="." index="1" instance=ExtResource( 3 )]
[node name="Sprite" parent="." instance=ExtResource( 3 )]

View File

@@ -5,26 +5,19 @@
[ext_resource path="res://turn_combat/combatants/sprites/green.png" type="Texture" id=3]
[node name="Opponent" instance=ExtResource( 1 )]
script = ExtResource( 2 )
_sections_unfolded = [ "Transform" ]
damage = 3
[node name="Health" parent="." index="0"]
life = 7
max_life = 7
[node name="Body" parent="Sprite/Pivot" index="1"]
texture = ExtResource( 3 )
[node name="Timer" type="Timer" parent="." index="2"]
process_mode = 1
wait_time = 0.25
one_shot = true
autostart = false
[editable path="Sprite"]

View File

@@ -4,10 +4,6 @@
[node name="Player" instance=ExtResource( 1 )]
_sections_unfolded = [ "Transform" ]
[node name="Health" parent="." index="0"]
base_armor = 1

View File

@@ -20,7 +20,7 @@ func take_damage(damage):
func heal(amount):
life += amount
clamp(life, life, max_life)
life = clamp(life, life, max_life)
emit_signal("health_changed", life)
func get_health_ratio():

View File

@@ -2,16 +2,6 @@
[ext_resource path="res://turn_combat/combatants/health/Health.gd" type="Script" id=1]
[node name="Health" type="Node"]
script = ExtResource( 1 )
life = 0
max_life = 10
armor = 0

View File

@@ -3,14 +3,9 @@
[ext_resource path="res://turn_combat/combatants/sprites/shadow.png" type="Texture" id=1]
[ext_resource path="res://turn_combat/combatants/sprites/blue.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "take_damage"
length = 0.2
loop = false
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Pivot/Body:modulate")
@@ -27,37 +22,18 @@ tracks/0/keys = {
[node name="Sprite" type="Node2D"]
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/take_damage = SubResource( 1 )
blend_times = [ ]
[node name="Tween" type="Tween" parent="." index="1"]
[node name="Tween" type="Tween" parent="."]
repeat = false
playback_process_mode = 1
playback_speed = 1.0
playback/active = false
playback/repeat = false
playback/speed = 1.0
[node name="Pivot" type="Position2D" parent="." index="2"]
[node name="Shadow" type="Sprite" parent="Pivot" index="0"]
[node name="Pivot" type="Position2D" parent="."]
[node name="Shadow" type="Sprite" parent="Pivot"]
position = Vector2( 0, -15 )
texture = ExtResource( 1 )
_sections_unfolded = [ "Transform" ]
[node name="Body" type="Sprite" parent="Pivot" index="1"]
[node name="Body" type="Sprite" parent="Pivot"]
position = Vector2( 0, -76 )
texture = ExtResource( 2 )
_sections_unfolded = [ "Visibility" ]

View File

@@ -2,10 +2,6 @@
[ext_resource path="res://turn_combat/turn_queue/TurnQueue.gd" type="Script" id=1]
[node name="TurnQueue" type="Node"]
script = ExtResource( 1 )
combatants_list = null