Add JRPGish demo (#267)
* Add JRPGish game * Fix typo and signals connection * Add missing last lines * Remove unused files
127
2d/role_playing_game/Game.tscn
Normal file
@@ -0,0 +1,127 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://screens/combat/Combat.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://screens/exploration/Exploration.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
|
||||
script/source = "extends Node
|
||||
|
||||
export (NodePath) var combat_screen
|
||||
export (NodePath) var exploration_screen
|
||||
|
||||
const PLAYER_WIN = \"res://dialog_system/dialogs/player_won.json\"
|
||||
const PLAYER_LOSE = \"res://dialog_system/dialogs/player_lose.json\"
|
||||
|
||||
func _ready():
|
||||
exploration_screen = get_node(exploration_screen)
|
||||
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.ACTOR:
|
||||
continue
|
||||
if not n.has_node(\"DialogPlayer\"):
|
||||
continue
|
||||
n.get_node(\"DialogPlayer\").connect(\"dialog_finished\", self,
|
||||
\"_on_opponent_dialog_finished\", [n])
|
||||
remove_child(combat_screen)
|
||||
|
||||
func _on_opponent_dialog_finished(opponent):
|
||||
if opponent.lost:
|
||||
return
|
||||
var player = $Exploration/Grid/Player
|
||||
var combatents = [player.combat_actor, opponent.combat_actor]
|
||||
start_combat(combatents)
|
||||
|
||||
func start_combat(combat_actors):
|
||||
remove_child($Exploration)
|
||||
$AnimationPlayer.play(\"fade\")
|
||||
yield($AnimationPlayer, \"animation_finished\")
|
||||
add_child(combat_screen)
|
||||
combat_screen.show()
|
||||
combat_screen.initialize(combat_actors)
|
||||
$AnimationPlayer.play_backwards(\"fade\")
|
||||
|
||||
func _on_combat_finished(winner, loser):
|
||||
remove_child(combat_screen)
|
||||
$AnimationPlayer.play_backwards(\"fade\")
|
||||
add_child(exploration_screen)
|
||||
var dialog = load(\"res://dialog_system/dialog_player/DialogPlayer.tscn\").instance()
|
||||
if winner.name == \"Player\":
|
||||
dialog.dialog_file = PLAYER_WIN
|
||||
else:
|
||||
dialog.dialog_file = PLAYER_LOSE
|
||||
yield($AnimationPlayer, \"animation_finished\")
|
||||
var player = $Exploration/Grid/Player
|
||||
exploration_screen.get_node(\"DialogUI\").show_dialog(player, dialog)
|
||||
combat_screen.clear_combat()
|
||||
yield(dialog, \"dialog_finished\")
|
||||
dialog.queue_free()
|
||||
"
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
|
||||
length = 0.5
|
||||
loop = false
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Transition/ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 0.0703125, 0.0703125, 0.0703125, 0 ), Color( 0.0703125, 0.0703125, 0.0703125, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
|
||||
script = SubResource( 1 )
|
||||
combat_screen = NodePath("Combat")
|
||||
exploration_screen = NodePath("Exploration")
|
||||
|
||||
[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
|
||||
anims/fade = SubResource( 2 )
|
||||
blend_times = [ ]
|
||||
|
||||
[node name="Transition" type="CanvasLayer" parent="." index="1"]
|
||||
|
||||
layer = 1
|
||||
offset = Vector2( 0, 0 )
|
||||
rotation = 0.0
|
||||
scale = Vector2( 1, 1 )
|
||||
transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="Transition" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 720.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
|
||||
color = Color( 0.0703125, 0.0703125, 0.0703125, 0 )
|
||||
_sections_unfolded = [ "Focus", "Mouse", "Visibility" ]
|
||||
|
||||
[node name="Combat" parent="." index="2" instance=ExtResource( 1 )]
|
||||
|
||||
visible = false
|
||||
|
||||
[node name="Exploration" parent="." index="3" instance=ExtResource( 2 )]
|
||||
|
||||
|
||||
101
2d/role_playing_game/default_env.tres
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
radiance_size = 4
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
sky_energy = 1.0
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
ground_energy = 1.0
|
||||
sun_color = Color( 1, 1, 1, 1 )
|
||||
sun_latitude = 35.0
|
||||
sun_longitude = 0.0
|
||||
sun_angle_min = 1.0
|
||||
sun_angle_max = 100.0
|
||||
sun_curve = 0.05
|
||||
sun_energy = 16.0
|
||||
texture_size = 2
|
||||
|
||||
[resource]
|
||||
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_custom_fov = 0.0
|
||||
background_color = Color( 0, 0, 0, 1 )
|
||||
background_energy = 1.0
|
||||
background_canvas_max_layer = 0
|
||||
ambient_light_color = Color( 0, 0, 0, 1 )
|
||||
ambient_light_energy = 1.0
|
||||
ambient_light_sky_contribution = 1.0
|
||||
fog_enabled = false
|
||||
fog_color = Color( 0.5, 0.6, 0.7, 1 )
|
||||
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
|
||||
fog_sun_amount = 0.0
|
||||
fog_depth_enabled = true
|
||||
fog_depth_begin = 10.0
|
||||
fog_depth_curve = 1.0
|
||||
fog_transmit_enabled = false
|
||||
fog_transmit_curve = 1.0
|
||||
fog_height_enabled = false
|
||||
fog_height_min = 0.0
|
||||
fog_height_max = 100.0
|
||||
fog_height_curve = 1.0
|
||||
tonemap_mode = 0
|
||||
tonemap_exposure = 1.0
|
||||
tonemap_white = 1.0
|
||||
auto_exposure_enabled = false
|
||||
auto_exposure_scale = 0.4
|
||||
auto_exposure_min_luma = 0.05
|
||||
auto_exposure_max_luma = 8.0
|
||||
auto_exposure_speed = 0.5
|
||||
ss_reflections_enabled = false
|
||||
ss_reflections_max_steps = 64
|
||||
ss_reflections_fade_in = 0.15
|
||||
ss_reflections_fade_out = 2.0
|
||||
ss_reflections_depth_tolerance = 0.2
|
||||
ss_reflections_roughness = true
|
||||
ssao_enabled = false
|
||||
ssao_radius = 1.0
|
||||
ssao_intensity = 1.0
|
||||
ssao_radius2 = 0.0
|
||||
ssao_intensity2 = 1.0
|
||||
ssao_bias = 0.01
|
||||
ssao_light_affect = 0.0
|
||||
ssao_color = Color( 0, 0, 0, 1 )
|
||||
ssao_quality = 0
|
||||
ssao_blur = 3
|
||||
ssao_edge_sharpness = 4.0
|
||||
dof_blur_far_enabled = false
|
||||
dof_blur_far_distance = 10.0
|
||||
dof_blur_far_transition = 5.0
|
||||
dof_blur_far_amount = 0.1
|
||||
dof_blur_far_quality = 1
|
||||
dof_blur_near_enabled = false
|
||||
dof_blur_near_distance = 2.0
|
||||
dof_blur_near_transition = 1.0
|
||||
dof_blur_near_amount = 0.1
|
||||
dof_blur_near_quality = 1
|
||||
glow_enabled = false
|
||||
glow_levels/1 = false
|
||||
glow_levels/2 = false
|
||||
glow_levels/3 = true
|
||||
glow_levels/4 = false
|
||||
glow_levels/5 = true
|
||||
glow_levels/6 = false
|
||||
glow_levels/7 = false
|
||||
glow_intensity = 0.8
|
||||
glow_strength = 1.0
|
||||
glow_bloom = 0.0
|
||||
glow_blend_mode = 2
|
||||
glow_hdr_threshold = 1.0
|
||||
glow_hdr_scale = 2.0
|
||||
glow_bicubic_upscale = false
|
||||
adjustment_enabled = false
|
||||
adjustment_brightness = 1.0
|
||||
adjustment_contrast = 1.0
|
||||
adjustment_saturation = 1.0
|
||||
|
||||
11
2d/role_playing_game/dialog_system/dialog_player/DialogPlayer.tscn
Executable file
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://dialog_system/dialog_player/dialog_player.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[node name="DialogPlayer" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
dialog_file = null
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
extends Node
|
||||
|
||||
export (String, FILE, "*.json") var dialog_file
|
||||
var dialog_keys = []
|
||||
var dialog_name = ""
|
||||
var current = 0
|
||||
var dialog_text = ""
|
||||
|
||||
signal dialog_started
|
||||
signal dialog_finished
|
||||
|
||||
func start_dialog():
|
||||
emit_signal("dialog_started")
|
||||
current = 0
|
||||
index_dialog()
|
||||
dialog_text = dialog_keys[current].text
|
||||
dialog_name = dialog_keys[current].name
|
||||
|
||||
func next_dialog():
|
||||
current += 1
|
||||
if current == dialog_keys.size():
|
||||
emit_signal("dialog_finished")
|
||||
return
|
||||
dialog_text = dialog_keys[current].text
|
||||
dialog_name = dialog_keys[current].name
|
||||
|
||||
func index_dialog():
|
||||
var dialog = load_dialogue(dialog_file)
|
||||
dialog_keys.clear()
|
||||
for key in dialog:
|
||||
dialog_keys.append(dialog[key])
|
||||
|
||||
func load_dialogue(file_path):
|
||||
var file = File.new()
|
||||
if file.file_exists(file_path):
|
||||
file.open(file_path, file.READ)
|
||||
var dialog = parse_json(file.get_as_text())
|
||||
return dialog
|
||||
5
2d/role_playing_game/dialog_system/dialogs/npc_01.json
Executable file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dialog_1" : {"name": "Unknown", "text": "Hey, it's a good time to have a JRPG fight, right?"},
|
||||
"dialog_2" : {"name": "Unknown", "text": "Let me present myself, I'm Opponent"},
|
||||
"dialog_3" : {"name": "Opponent", "text": "Enough talk, let's fight!"},
|
||||
}
|
||||
3
2d/role_playing_game/dialog_system/dialogs/object.json
Executable file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"dialog_1" : {"name":"Player", "text":"Just some object..." }
|
||||
}
|
||||
4
2d/role_playing_game/dialog_system/dialogs/player_lose.json
Executable file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"dialog_1" : {"name": "Opponent", "text": "Aha! I won, maybe you can try again next time"},
|
||||
"dialog_2" : {"name": "Opponent", "text": "Now let me wonder around again..."},
|
||||
}
|
||||
4
2d/role_playing_game/dialog_system/dialogs/player_won.json
Executable file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"dialog_1" : {"name": "Opponent", "text": "Congratulations, you won!"},
|
||||
"dialog_2" : {"name": "Opponent", "text": "Now let me wonder around again..."},
|
||||
}
|
||||
144
2d/role_playing_game/dialog_system/interface/DialogUI.tscn
Normal file
@@ -0,0 +1,144 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://theme/theme.tres" type="Theme" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
|
||||
script/source = "extends Control
|
||||
|
||||
var dialog_node = null
|
||||
func _ready():
|
||||
hide()
|
||||
|
||||
func show_dialog(player, dialog):
|
||||
show()
|
||||
$Button.grab_focus()
|
||||
dialog_node = dialog
|
||||
for c in dialog.get_signal_connection_list(\"dialog_finished\"):
|
||||
if self == c.target:
|
||||
dialog_node.start_dialog()
|
||||
break
|
||||
return
|
||||
dialog_node.connect(\"dialog_started\", player, \"set_active\", [false])
|
||||
dialog_node.connect(\"dialog_finished\", player, \"set_active\", [true])
|
||||
dialog_node.connect(\"dialog_finished\", self, \"hide\")
|
||||
dialog_node.connect(\"dialog_finished\", self, \"_on_dialog_finished\", [player])
|
||||
dialog_node.start_dialog()
|
||||
$Name.text = dialog_node.dialog_name
|
||||
$Text.text = dialog_node.dialog_text
|
||||
|
||||
|
||||
func _on_Button_button_up():
|
||||
dialog_node.next_dialog()
|
||||
$Name.text = dialog_node.dialog_name
|
||||
$Text.text = dialog_node.dialog_text
|
||||
|
||||
func _on_dialog_finished(player):
|
||||
dialog_node.disconnect(\"dialog_started\", player, \"set_active\")
|
||||
dialog_node.disconnect(\"dialog_finished\", player, \"set_active\")
|
||||
dialog_node.disconnect(\"dialog_finished\", self, \"hide\")
|
||||
dialog_node.disconnect(\"dialog_finished\", self, \"_on_dialog_finished\")
|
||||
"
|
||||
|
||||
[node name="DialogUI" type="Panel" index="0"]
|
||||
|
||||
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 = SubResource( 1 )
|
||||
|
||||
[node name="Name" type="RichTextLabel" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
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
|
||||
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 = "Dialog 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
|
||||
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"]
|
||||
|
||||
|
||||
36
2d/role_playing_game/grid_movement/grid/grid.gd
Executable file
@@ -0,0 +1,36 @@
|
||||
extends TileMap
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(NodePath) var dialog_ui
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
set_cellv(world_to_map(child.position), child.type)
|
||||
|
||||
|
||||
func get_cell_pawn(cell, type = ACTOR):
|
||||
for node in get_children():
|
||||
if node.type != type:
|
||||
continue
|
||||
if world_to_map(node.position) == cell:
|
||||
return(node)
|
||||
|
||||
|
||||
func request_move(pawn, direction):
|
||||
var cell_start = world_to_map(pawn.position)
|
||||
var cell_target = cell_start + direction
|
||||
|
||||
var cell_tile_id = get_cellv(cell_target)
|
||||
match cell_tile_id:
|
||||
-1:
|
||||
set_cellv(cell_target, ACTOR)
|
||||
set_cellv(cell_start, -1)
|
||||
return map_to_world(cell_target) + cell_size / 2
|
||||
OBJECT, ACTOR:
|
||||
var target_pawn = get_cell_pawn(cell_target, cell_tile_id)
|
||||
print("Cell %s contains %s" % [cell_target, target_pawn.name])
|
||||
|
||||
if not target_pawn.has_node("DialogPlayer"):
|
||||
return
|
||||
get_node(dialog_ui).show_dialog(pawn, target_pawn.get_node("DialogPlayer"))
|
||||
|
||||
111
2d/role_playing_game/grid_movement/pawns/Actor.tscn
Executable file
@@ -0,0 +1,111 @@
|
||||
[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/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")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.02, 0.04, 0.06, 0.08, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( -1.5, -9 ), Vector2( 6.5, 2.5 ), Vector2( -11.5, 8.5 ), Vector2( 4, -5 ), Vector2( 0, 0 ) ]
|
||||
}
|
||||
|
||||
[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")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = false
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0.9375, 0, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Pivot/Sprite:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.15, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 0.303143, 2.61003, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 0, -20 ), Vector2( 1.43051e-06, -1.90735e-06 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Pivot/Sprite:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.05, 0.15, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 0.354553, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="Actor" type="Node2D" index="0"]
|
||||
|
||||
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
|
||||
anims/bump = SubResource( 1 )
|
||||
anims/walk = SubResource( 2 )
|
||||
blend_times = [ ]
|
||||
|
||||
[node name="Tween" type="Tween" parent="." index="1"]
|
||||
|
||||
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"]
|
||||
|
||||
texture = ExtResource( 2 )
|
||||
centered = false
|
||||
offset = Vector2( -32, -32 )
|
||||
_sections_unfolded = [ "Transform", "Visibility" ]
|
||||
|
||||
|
||||
44
2d/role_playing_game/grid_movement/pawns/actor.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
extends 'pawn.gd'
|
||||
|
||||
onready var Grid = get_parent()
|
||||
var lost = false
|
||||
|
||||
func _ready():
|
||||
update_look_direction(Vector2(1, 0))
|
||||
|
||||
func _process(delta):
|
||||
var input_direction = get_input_direction()
|
||||
if not input_direction:
|
||||
return
|
||||
update_look_direction(input_direction)
|
||||
|
||||
var target_position = Grid.request_move(self, input_direction)
|
||||
if target_position:
|
||||
move_to(target_position)
|
||||
$Tween.start()
|
||||
else:
|
||||
bump()
|
||||
|
||||
func get_input_direction():
|
||||
return Vector2(
|
||||
int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left")),
|
||||
int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up"))
|
||||
)
|
||||
|
||||
func update_look_direction(direction):
|
||||
$Pivot/Sprite.rotation = direction.angle()
|
||||
|
||||
func move_to(target_position):
|
||||
set_process(false)
|
||||
$AnimationPlayer.play("walk")
|
||||
var move_direction = (position - target_position).normalized()
|
||||
$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():
|
||||
$AnimationPlayer.play("bump")
|
||||
BIN
2d/role_playing_game/grid_movement/pawns/character.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |
29
2d/role_playing_game/grid_movement/pawns/character.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/character.png-5e19af0401d52b4620fb84d898126e01.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/pawns/character.png"
|
||||
dest_files=[ "res://.import/character.png-5e19af0401d52b4620fb84d898126e01.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
7
2d/role_playing_game/grid_movement/pawns/idle_actor.gd
Executable file
@@ -0,0 +1,7 @@
|
||||
extends 'actor.gd'
|
||||
|
||||
func _ready():
|
||||
set_process(false)
|
||||
|
||||
func get_input_direction():
|
||||
return Vector2(0, 0)
|
||||
12
2d/role_playing_game/grid_movement/pawns/pawn.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Node2D
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(CELL_TYPES) var type = ACTOR
|
||||
|
||||
export (PackedScene) var combat_actor
|
||||
var active = true setget set_active
|
||||
|
||||
func set_active(value):
|
||||
active = value
|
||||
set_process(value)
|
||||
set_process_input(value)
|
||||
16
2d/role_playing_game/grid_movement/pawns/random_actor.gd
Executable file
@@ -0,0 +1,16 @@
|
||||
extends "actor.gd"
|
||||
|
||||
const DIRECTIONS = [-1, 1]
|
||||
|
||||
func get_input_direction():
|
||||
if not active:
|
||||
return Vector2()
|
||||
var random_x = DIRECTIONS[randi() % DIRECTIONS.size()]
|
||||
var random_y = DIRECTIONS[randi() % DIRECTIONS.size()]
|
||||
|
||||
var random_axis = randi()%2
|
||||
if random_axis > 0:
|
||||
random_x = 0
|
||||
else:
|
||||
random_y = 0
|
||||
return Vector2(random_x, random_y)
|
||||
28
2d/role_playing_game/grid_movement/tilesets/grid/GridTiles.tscn
Executable file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://grid_movement/tilesets/grid/actor.png" type="Texture" id=1]
|
||||
[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"]
|
||||
|
||||
position = Vector2( 32, 32 )
|
||||
texture = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
[node name="Obstacle" type="Sprite" parent="." index="1"]
|
||||
|
||||
position = Vector2( 96, 32 )
|
||||
texture = ExtResource( 2 )
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
[node name="Object" type="Sprite" parent="." index="2"]
|
||||
|
||||
position = Vector2( 160, 32 )
|
||||
texture = ExtResource( 3 )
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
|
||||
BIN
2d/role_playing_game/grid_movement/tilesets/grid/actor.png
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
29
2d/role_playing_game/grid_movement/tilesets/grid/actor.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/actor.png-147dff690f83be8a2c66a5bfa83da49f.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid/actor.png"
|
||||
dest_files=[ "res://.import/actor.png-147dff690f83be8a2c66a5bfa83da49f.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
38
2d/role_playing_game/grid_movement/tilesets/grid/grid_tileset.tres
Executable file
@@ -0,0 +1,38 @@
|
||||
[gd_resource type="TileSet" load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://grid_movement/tilesets/grid/actor.png" type="Texture" id=1]
|
||||
[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]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
0/name = "Actor"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 64, 64 )
|
||||
0/is_autotile = false
|
||||
0/occluder_offset = Vector2( 32, 32 )
|
||||
0/navigation_offset = Vector2( 32, 32 )
|
||||
0/shapes = [ ]
|
||||
1/name = "Obstacle"
|
||||
1/texture = ExtResource( 2 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 0, 64, 64 )
|
||||
1/is_autotile = false
|
||||
1/occluder_offset = Vector2( 32, 32 )
|
||||
1/navigation_offset = Vector2( 32, 32 )
|
||||
1/shapes = [ ]
|
||||
2/name = "Object"
|
||||
2/texture = ExtResource( 3 )
|
||||
2/tex_offset = Vector2( 0, 0 )
|
||||
2/modulate = Color( 1, 1, 1, 1 )
|
||||
2/region = Rect2( 0, 0, 64, 64 )
|
||||
2/is_autotile = false
|
||||
2/occluder_offset = Vector2( 32, 32 )
|
||||
2/navigation_offset = Vector2( 32, 32 )
|
||||
2/shapes = [ ]
|
||||
_sections_unfolded = [ "0", "1" ]
|
||||
|
||||
BIN
2d/role_playing_game/grid_movement/tilesets/grid/object.png
Executable file
|
After Width: | Height: | Size: 1.8 KiB |
29
2d/role_playing_game/grid_movement/tilesets/grid/object.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid/object.png"
|
||||
dest_files=[ "res://.import/object.png-f9ec4c5540ae154e2e73d50438312f26.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/grid_movement/tilesets/grid/obstacle.png
Executable file
|
After Width: | Height: | Size: 595 B |
29
2d/role_playing_game/grid_movement/tilesets/grid/obstacle.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid/obstacle.png"
|
||||
dest_files=[ "res://.import/obstacle.png-303025fbfb0bdc414a247e8ee1624a90.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
13
2d/role_playing_game/grid_movement/tilesets/grid_lines/GridLinesTiles.tscn
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[node name="TileSet" type="Node2D" index="0"]
|
||||
|
||||
[node name="Grass" type="Sprite" parent="." index="0"]
|
||||
|
||||
position = Vector2( 32, 32 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
|
||||
BIN
2d/role_playing_game/grid_movement/tilesets/grid_lines/grid_lines.png
Executable file
|
After Width: | Height: | Size: 656 B |
29
2d/role_playing_game/grid_movement/tilesets/grid_lines/grid_lines.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://grid_movement/tilesets/grid_lines/grid_lines.png"
|
||||
dest_files=[ "res://.import/grid_lines.png-151c8a0e38dd3f92e569d4b4f869a28e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
@@ -0,0 +1,17 @@
|
||||
[gd_resource type="TileSet" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
0/name = "Grass"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 64, 64 )
|
||||
0/is_autotile = false
|
||||
0/occluder_offset = Vector2( 32, 32 )
|
||||
0/navigation_offset = Vector2( 32, 32 )
|
||||
0/shapes = [ ]
|
||||
|
||||
BIN
2d/role_playing_game/icon.png
Executable file
|
After Width: | Height: | Size: 3.4 KiB |
29
2d/role_playing_game/icon.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
24
2d/role_playing_game/project.godot
Executable file
@@ -0,0 +1,24 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=3
|
||||
|
||||
[application]
|
||||
|
||||
config/name="JRPG Demo"
|
||||
run/main_scene="res://Game.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
||||
245
2d/role_playing_game/screens/combat/Combat.tscn
Normal file
@@ -0,0 +1,245 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://turn_combat_system/turn_queue/TurnQueue.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://theme/theme.tres" type="Theme" id=2]
|
||||
[ext_resource path="res://screens/combat/interface/UI.gd" type="Script" id=3]
|
||||
[ext_resource path="res://screens/combat/interface/ActorInfo.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
|
||||
script/source = "extends Node
|
||||
|
||||
signal combat_finished(winner, loser)
|
||||
|
||||
func initialize(combat_actors):
|
||||
for actor in combat_actors:
|
||||
actor = actor.instance()
|
||||
if actor is load(\"res://turn_combat_system/actors/Actor.gd\"):
|
||||
$Actors.add_actor(actor)
|
||||
actor.get_node(\"Health\").connect(\"dead\", self, \"_on_actor_death\", [actor])
|
||||
else:
|
||||
actor.queue_free()
|
||||
$UI.initialize()
|
||||
$TurnQueue.initialize()
|
||||
$TurnQueue.play_turn()
|
||||
$UI/Buttons/GridContainer/Attack.grab_focus()
|
||||
|
||||
func _on_actor_death(actor):
|
||||
var winner
|
||||
if not actor.name == \"Player\":
|
||||
winner = $Actors/Player
|
||||
else:
|
||||
for n in $Actors.get_children():
|
||||
if not n.name == \"Player\":
|
||||
winner = n
|
||||
break
|
||||
emit_signal(\"combat_finished\", winner, actor)
|
||||
|
||||
func clear_combat():
|
||||
for n in $Actors.get_children():
|
||||
n.queue_free()
|
||||
for n in $UI/Actors.get_children():
|
||||
n.queue_free()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id=2]
|
||||
|
||||
script/source = "extends Node2D
|
||||
|
||||
func add_actor(actor):
|
||||
actor.position.x += 200 * get_child_count()
|
||||
add_child(actor)"
|
||||
|
||||
[node name="Combat" type="Node2D"]
|
||||
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="TurnQueue" parent="." index="0" instance=ExtResource( 1 )]
|
||||
|
||||
actors_node = NodePath("../Actors")
|
||||
|
||||
[node name="Actors" type="Node2D" parent="." index="1"]
|
||||
|
||||
position = Vector2( 539, 275 )
|
||||
script = SubResource( 2 )
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="UI" type="Control" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.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( 2 )
|
||||
script = ExtResource( 3 )
|
||||
_sections_unfolded = [ "Theme" ]
|
||||
actors_node = NodePath("../Actors")
|
||||
actor_info = ExtResource( 4 )
|
||||
|
||||
[node name="Actors" type="HBoxContainer" parent="UI" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
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
|
||||
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
|
||||
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
|
||||
margin_right = 468.0
|
||||
margin_bottom = 119.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
|
||||
margin_left = 472.0
|
||||
margin_right = 940.0
|
||||
margin_bottom = 119.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="Inventory" type="Button" parent="UI/Buttons/GridContainer" index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 123.0
|
||||
margin_right = 468.0
|
||||
margin_bottom = 242.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 = "Inventory"
|
||||
flat = false
|
||||
align = 1
|
||||
|
||||
[node name="Flee" type="Button" parent="UI/Buttons/GridContainer" index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 472.0
|
||||
margin_top = 123.0
|
||||
margin_right = 940.0
|
||||
margin_bottom = 242.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"]
|
||||
|
||||
|
||||
20
2d/role_playing_game/screens/combat/actors/Actor.tscn
Executable file
@@ -0,0 +1,20 @@
|
||||
[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://screens/combat/actors/sprites/Sprite.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Actor" type="Node2D" index="0"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
damage = 2
|
||||
defense = 1
|
||||
|
||||
[node name="Health" parent="." index="0" instance=ExtResource( 2 )]
|
||||
|
||||
life = 10
|
||||
armor = 2
|
||||
|
||||
[node name="Sprite" type="Node2D" parent="." index="1" instance=ExtResource( 3 )]
|
||||
|
||||
|
||||
49
2d/role_playing_game/screens/combat/actors/Opponent.tscn
Executable file
@@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://screens/combat/actors/Actor.tscn" type="PackedScene" id=1]
|
||||
[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\"
|
||||
|
||||
func set_active(value):
|
||||
.set_active(value)
|
||||
if not active:
|
||||
return
|
||||
|
||||
$Timer.start()
|
||||
yield($Timer, \"timeout\")
|
||||
var target
|
||||
for actor in get_parent().get_children():
|
||||
if not actor == self:
|
||||
target = actor
|
||||
break
|
||||
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"]
|
||||
14
2d/role_playing_game/screens/combat/actors/Player.tscn
Executable file
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[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
|
||||
|
||||
|
||||
61
2d/role_playing_game/screens/combat/actors/sprites/Sprite.tscn
Executable file
@@ -0,0 +1,61 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[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")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 3, 0.253906, 0.253906, 1 ), Color( 1, 1, 1, 1 ), Color( 3, 0.253906, 0.253906, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
|
||||
[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
|
||||
anims/take_damage = SubResource( 1 )
|
||||
blend_times = [ ]
|
||||
|
||||
[node name="Tween" type="Tween" parent="." index="1"]
|
||||
|
||||
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"]
|
||||
|
||||
position = Vector2( 0, -15 )
|
||||
texture = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Transform" ]
|
||||
|
||||
[node name="Body" type="Sprite" parent="Pivot" index="1"]
|
||||
|
||||
position = Vector2( 0, -76 )
|
||||
texture = ExtResource( 2 )
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
|
||||
BIN
2d/role_playing_game/screens/combat/actors/sprites/blue.png
Executable file
|
After Width: | Height: | Size: 1.9 KiB |
29
2d/role_playing_game/screens/combat/actors/sprites/blue.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/blue.png-127e2b8d7aa8f4a7572c4923c2b20228.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://screens/combat/actors/sprites/blue.png"
|
||||
dest_files=[ "res://.import/blue.png-127e2b8d7aa8f4a7572c4923c2b20228.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/screens/combat/actors/sprites/green.png
Executable file
|
After Width: | Height: | Size: 1.9 KiB |
29
2d/role_playing_game/screens/combat/actors/sprites/green.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/green.png-7937ec3931675b5dd0f218cbb8ae006a.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://screens/combat/actors/sprites/green.png"
|
||||
dest_files=[ "res://.import/green.png-7937ec3931675b5dd0f218cbb8ae006a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/screens/combat/actors/sprites/shadow.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
29
2d/role_playing_game/screens/combat/actors/sprites/shadow.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/shadow.png-3c36ca984d4b9e8eba8c422537f5ca42.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://screens/combat/actors/sprites/shadow.png"
|
||||
dest_files=[ "res://.import/shadow.png-3c36ca984d4b9e8eba8c422537f5ca42.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
72
2d/role_playing_game/screens/combat/interface/ActorInfo.tscn
Executable file
@@ -0,0 +1,72 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[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
|
||||
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 )]
|
||||
|
||||
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
|
||||
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
|
||||
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" ]
|
||||
|
||||
|
||||
34
2d/role_playing_game/screens/combat/interface/UI.gd
Normal file
@@ -0,0 +1,34 @@
|
||||
extends Control
|
||||
|
||||
export (NodePath) var actors_node
|
||||
export (PackedScene) var actor_info
|
||||
|
||||
func _ready():
|
||||
actors_node = get_node(actors_node)
|
||||
|
||||
func initialize():
|
||||
for actor in actors_node.get_children():
|
||||
var health = actor.get_node("Health")
|
||||
var info = actor_info.instance()
|
||||
var health_info = info.get_node("VBoxContainer/Health")
|
||||
health_info.value = health.life
|
||||
health_info.max_value = health.max_life
|
||||
info.get_node("VBoxContainer/Name").text = actor.name
|
||||
health.connect("health_changed", health_info, "set_value")
|
||||
$Actors.add_child(info)
|
||||
|
||||
func _on_Attack_button_up():
|
||||
if not actors_node.get_node("Player").active:
|
||||
return
|
||||
actors_node.get_node("Player").attack(actors_node.get_node("Opponent"))
|
||||
|
||||
func _on_Defend_button_up():
|
||||
if not actors_node.get_node("Player").active:
|
||||
return
|
||||
actors_node.get_node("Player").defend()
|
||||
|
||||
func _on_Flee_button_up():
|
||||
if not actors_node.get_node("Player").active:
|
||||
return
|
||||
actors_node.get_node("Player").flee()
|
||||
get_parent().emit_signal("combat_finished", $"../Actors/Opponent", $"../Actors/Player")
|
||||
111
2d/role_playing_game/screens/exploration/Exploration.tscn
Normal file
@@ -0,0 +1,111 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://grid_movement/tilesets/grid_lines/grid_lines_tileset.tres" type="TileSet" id=1]
|
||||
[ext_resource path="res://grid_movement/tilesets/grid/grid_tileset.tres" type="TileSet" id=2]
|
||||
[ext_resource path="res://grid_movement/grid/grid.gd" type="Script" id=3]
|
||||
[ext_resource path="res://grid_movement/pawns/Actor.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://screens/combat/actors/Player.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://grid_movement/pawns/idle_actor.gd" type="Script" id=6]
|
||||
[ext_resource path="res://screens/combat/actors/Opponent.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://dialog_system/dialog_player/DialogPlayer.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://grid_movement/pawns/pawn.gd" type="Script" id=9]
|
||||
[ext_resource path="res://dialog_system/interface/DialogUI.tscn" type="PackedScene" id=10]
|
||||
|
||||
[node name="Exploration" type="Node2D"]
|
||||
|
||||
[node name="Grass" type="TileMap" parent="." index="0"]
|
||||
|
||||
modulate = Color( 1, 1, 1, 0.271059 )
|
||||
z_index = -1
|
||||
z_as_relative = false
|
||||
mode = 0
|
||||
tile_set = ExtResource( 1 )
|
||||
cell_size = Vector2( 64, 64 )
|
||||
cell_quadrant_size = 16
|
||||
cell_custom_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
cell_half_offset = 2
|
||||
cell_tile_origin = 0
|
||||
cell_y_sort = false
|
||||
cell_clip_uv = false
|
||||
collision_use_kinematic = false
|
||||
collision_friction = 1.0
|
||||
collision_bounce = 0.0
|
||||
collision_layer = 1
|
||||
collision_mask = 1
|
||||
occluder_light_mask = 1
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 0, 65536, 0, 0, 65537, 0, 0, 65538, 0, 0, 65539, 0, 0, 65540, 0, 0, 65541, 0, 0, 65542, 0, 0, 65543, 0, 0, 65544, 0, 0, 65545, 0, 0, 65546, 0, 0, 65547, 0, 0, 65548, 0, 0, 65549, 0, 0, 65550, 0, 0, 65551, 0, 0, 65552, 0, 0, 131072, 0, 0, 131073, 0, 0, 131074, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 131079, 0, 0, 131080, 0, 0, 131081, 0, 0, 131082, 0, 0, 131083, 0, 0, 131084, 0, 0, 131085, 0, 0, 131086, 0, 0, 131087, 0, 0, 131088, 0, 0, 196608, 0, 0, 196609, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 196616, 0, 0, 196617, 0, 0, 196618, 0, 0, 196619, 0, 0, 196620, 0, 0, 196621, 0, 0, 196622, 0, 0, 196623, 0, 0, 196624, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 0, 0, 262155, 0, 0, 262156, 0, 0, 262157, 0, 0, 262158, 0, 0, 262159, 0, 0, 262160, 0, 0, 327680, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 327689, 0, 0, 327690, 0, 0, 327691, 0, 0, 327692, 0, 0, 327693, 0, 0, 327694, 0, 0, 327695, 0, 0, 327696, 0, 0, 393216, 0, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 393225, 0, 0, 393226, 0, 0, 393227, 0, 0, 393228, 0, 0, 393229, 0, 0, 393230, 0, 0, 393231, 0, 0, 393232, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 458765, 0, 0, 458766, 0, 0, 458767, 0, 0, 458768, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0 )
|
||||
_sections_unfolded = [ "Visibility", "Z Index" ]
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Grid" type="TileMap" parent="." index="1"]
|
||||
|
||||
mode = 0
|
||||
tile_set = ExtResource( 2 )
|
||||
cell_size = Vector2( 64, 64 )
|
||||
cell_quadrant_size = 16
|
||||
cell_custom_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
cell_half_offset = 2
|
||||
cell_tile_origin = 0
|
||||
cell_y_sort = false
|
||||
cell_clip_uv = false
|
||||
collision_use_kinematic = false
|
||||
collision_friction = 1.0
|
||||
collision_bounce = 0.0
|
||||
collision_layer = 1
|
||||
collision_mask = 1
|
||||
occluder_light_mask = 1
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 0, 5, 1, 0, 6, 1, 0, 7, 1, 0, 8, 1, 0, 9, 1, 0, 10, 1, 0, 11, 1, 0, 12, 1, 0, 13, 1, 0, 14, 1, 0, 15, 1, 0, 16, 1, 0, 17, 1, 0, 18, 1, 0, 19, 1, 0, 65536, 1, 0, 65554, 1, 0, 65555, 1, 0, 131072, 1, 0, 131090, 1, 0, 131091, 1, 0, 196608, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 1, 0, 196626, 1, 0, 196627, 1, 0, 262144, 1, 0, 262151, 1, 0, 262162, 1, 0, 262163, 1, 0, 327680, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327698, 1, 0, 327699, 1, 0, 393216, 1, 0, 393234, 1, 0, 393235, 1, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458770, 1, 0, 458771, 1, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524306, 1, 0, 524307, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 1, 0, 589831, 1, 0, 589842, 1, 0, 589843, 1, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 1, 0, 655372, 1, 0, 655373, 1, 0, 655374, 1, 0, 655375, 1, 0, 655376, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 1, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720900, 1, 0, 720901, 1, 0, 720902, 1, 0, 720903, 1, 0, 720904, 1, 0, 720905, 1, 0, 720906, 1, 0, 720907, 1, 0, 720908, 1, 0, 720909, 1, 0, 720910, 1, 0, 720911, 1, 0, 720912, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 1, 0 )
|
||||
script = ExtResource( 3 )
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
dialog_ui = NodePath("../DialogUI")
|
||||
|
||||
[node name="Player" parent="Grid" index="0" instance=ExtResource( 4 )]
|
||||
|
||||
editor/display_folded = true
|
||||
position = Vector2( 416, 288 )
|
||||
combat_actor = ExtResource( 5 )
|
||||
|
||||
[node name="Opponent" parent="Grid" index="1" instance=ExtResource( 4 )]
|
||||
|
||||
position = Vector2( 800, 480 )
|
||||
rotation = -1.5708
|
||||
script = ExtResource( 6 )
|
||||
combat_actor = ExtResource( 7 )
|
||||
|
||||
[node name="DialogPlayer" parent="Grid/Opponent" index="3" instance=ExtResource( 8 )]
|
||||
|
||||
dialog_file = "res://dialog_system/dialogs/npc_01.json"
|
||||
|
||||
[node name="Timer" type="Timer" parent="Grid/Opponent" index="4"]
|
||||
|
||||
process_mode = 1
|
||||
wait_time = 1.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="Object" type="Node2D" parent="Grid" index="2"]
|
||||
|
||||
editor/display_folded = true
|
||||
position = Vector2( 544, 288 )
|
||||
script = ExtResource( 9 )
|
||||
type = 2
|
||||
combat_actor = null
|
||||
|
||||
[node name="DialogPlayer" parent="Grid/Object" index="0" instance=ExtResource( 8 )]
|
||||
|
||||
dialog_file = "res://dialog_system/dialogs/object.json"
|
||||
|
||||
[node name="DialogUI" parent="." index="2" instance=ExtResource( 10 )]
|
||||
|
||||
[connection signal="dialog_finished" from="Grid/Opponent/DialogPlayer" to="Grid/Opponent" method="set_active" binds= [ true ]]
|
||||
|
||||
[connection signal="dialog_started" from="Grid/Opponent/DialogPlayer" to="Grid/Opponent" method="set_active" binds= [ false ]]
|
||||
|
||||
|
||||
234
2d/role_playing_game/theme/Theme.tscn
Executable file
@@ -0,0 +1,234 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://theme/theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://theme/labels/Title.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://theme/fonts/montserrat_extra_bold_24.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://theme/progressbar/foreground_stylebox_red.tres" type="StyleBox" id=4]
|
||||
[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():
|
||||
set_process(false)
|
||||
|
||||
func _process(delta):
|
||||
for p in get_children():
|
||||
$ProgressBarBlue.value += 10 * delta
|
||||
$ProgressBarRed.value += 10 * delta
|
||||
|
||||
|
||||
func _on_Button_button_down():
|
||||
set_process(true)
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
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 )]
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
margin_right = 396.0
|
||||
margin_bottom = 130.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
|
||||
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
|
||||
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
|
||||
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
|
||||
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"]
|
||||
|
||||
|
||||
BIN
2d/role_playing_game/theme/button/button_rect.png
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
29
2d/role_playing_game/theme/button/button_rect.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/button_rect.png-50631b7139a07837e9f4856772433e8e.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/button/button_rect.png"
|
||||
dest_files=[ "res://.import/button_rect.png-50631b7139a07837e9f4856772433e8e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/theme/button/button_rect_pressed.png
Executable file
|
After Width: | Height: | Size: 2.9 KiB |
29
2d/role_playing_game/theme/button/button_rect_pressed.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/button_rect_pressed.png-e5e25d3b6005d4ba5edf4354beb6dc06.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/button/button_rect_pressed.png"
|
||||
dest_files=[ "res://.import/button_rect_pressed.png-e5e25d3b6005d4ba5edf4354beb6dc06.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/theme/fonts/Montserrat-ExtraBold.otf
Executable file
13
2d/role_playing_game/theme/fonts/montserrat_extra_bold_16.tres
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
size = 16
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Settings" ]
|
||||
|
||||
13
2d/role_playing_game/theme/fonts/montserrat_extra_bold_24.tres
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
size = 32
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Settings" ]
|
||||
|
||||
13
2d/role_playing_game/theme/fonts/montserrat_extra_bold_32.tres
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
size = 32
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Settings" ]
|
||||
|
||||
13
2d/role_playing_game/theme/fonts/montserrat_extra_bold_48.tres
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
size = 48
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Settings" ]
|
||||
|
||||
13
2d/role_playing_game/theme/fonts/montserrat_extra_bold_62.tres
Executable file
@@ -0,0 +1,13 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
size = 62
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Settings" ]
|
||||
|
||||
32
2d/role_playing_game/theme/labels/Title.tscn
Executable file
@@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[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 )
|
||||
custom_constants/shadow_offset_y = 5
|
||||
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" ]
|
||||
|
||||
|
||||
BIN
2d/role_playing_game/theme/panel/panel_rect.png
Executable file
|
After Width: | Height: | Size: 3.8 KiB |
29
2d/role_playing_game/theme/panel/panel_rect.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/panel_rect.png-52b8de43da3f3ba3a0682eb789a33286.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/panel/panel_rect.png"
|
||||
dest_files=[ "res://.import/panel_rect.png-52b8de43da3f3ba3a0682eb789a33286.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/theme/progressbar/background.png
Executable file
|
After Width: | Height: | Size: 5.1 KiB |
29
2d/role_playing_game/theme/progressbar/background.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/background.png-db91f961480760b8bfa082076dc72dbd.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/progressbar/background.png"
|
||||
dest_files=[ "res://.import/background.png-db91f961480760b8bfa082076dc72dbd.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/theme/progressbar/foreground_blue.png
Executable file
|
After Width: | Height: | Size: 5.6 KiB |
29
2d/role_playing_game/theme/progressbar/foreground_blue.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/foreground_blue.png-1208ba20a94923d82a7b0eacc6914552.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/progressbar/foreground_blue.png"
|
||||
dest_files=[ "res://.import/foreground_blue.png-1208ba20a94923d82a7b0eacc6914552.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
2d/role_playing_game/theme/progressbar/foreground_red.png
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
29
2d/role_playing_game/theme/progressbar/foreground_red.png.import
Executable file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/foreground_red.png-60d00de182b78bd324a56c9f03008a15.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://theme/progressbar/foreground_red.png"
|
||||
dest_files=[ "res://.import/foreground_red.png-60d00de182b78bd324a56c9f03008a15.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
25
2d/role_playing_game/theme/progressbar/foreground_stylebox_blue.tres
Executable file
@@ -0,0 +1,25 @@
|
||||
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/progressbar/foreground_blue.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 64, 64 )
|
||||
margin_left = 18.0
|
||||
margin_right = 18.0
|
||||
margin_top = 18.0
|
||||
margin_bottom = 18.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Margin" ]
|
||||
|
||||
25
2d/role_playing_game/theme/progressbar/foreground_stylebox_red.tres
Executable file
@@ -0,0 +1,25 @@
|
||||
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://theme/progressbar/foreground_red.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 64, 64 )
|
||||
margin_left = 18.0
|
||||
margin_right = 18.0
|
||||
margin_top = 20.0
|
||||
margin_bottom = 20.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Margin" ]
|
||||
|
||||
152
2d/role_playing_game/theme/theme.tres
Normal file
@@ -0,0 +1,152 @@
|
||||
[gd_resource type="Theme" load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://theme/fonts/montserrat_extra_bold_32.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://theme/button/button_rect.png" type="Texture" id=2]
|
||||
[ext_resource path="res://theme/button/button_rect_pressed.png" type="Texture" id=3]
|
||||
[ext_resource path="res://theme/fonts/montserrat_extra_bold_24.tres" type="DynamicFont" id=4]
|
||||
[ext_resource path="res://theme/panel/panel_rect.png" type="Texture" id=5]
|
||||
[ext_resource path="res://theme/progressbar/background.png" type="Texture" id=6]
|
||||
[ext_resource path="res://theme/progressbar/foreground_stylebox_red.tres" type="StyleBox" id=7]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=1]
|
||||
|
||||
resource_name = "button_focus_style"
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
_sections_unfolded = [ "Resource" ]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=2]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 2 )
|
||||
region_rect = Rect2( 0, 0, 128, 142 )
|
||||
margin_left = 32.0
|
||||
margin_right = 32.0
|
||||
margin_top = 36.0
|
||||
margin_bottom = 43.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Axis Stretch", "Margin", "Modulate", "Resource" ]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=3]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 2 )
|
||||
region_rect = Rect2( 0, 0, 128, 142 )
|
||||
margin_left = 32.0
|
||||
margin_right = 32.0
|
||||
margin_top = 36.0
|
||||
margin_bottom = 43.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Axis Stretch", "Margin", "Modulate", "Resource" ]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=4]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 3 )
|
||||
region_rect = Rect2( 0, 0, 128, 142 )
|
||||
margin_left = 32.0
|
||||
margin_right = 32.0
|
||||
margin_top = 40.0
|
||||
margin_bottom = 32.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Axis Stretch", "Margin", "Resource" ]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=5]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 5 )
|
||||
region_rect = Rect2( 0, 0, 128, 141 )
|
||||
margin_left = 90.0
|
||||
margin_right = 90.0
|
||||
margin_top = 35.0
|
||||
margin_bottom = 45.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Axis Stretch", "Resource" ]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=6]
|
||||
|
||||
content_margin_left = -1.0
|
||||
content_margin_right = -1.0
|
||||
content_margin_top = -1.0
|
||||
content_margin_bottom = -1.0
|
||||
texture = ExtResource( 6 )
|
||||
region_rect = Rect2( 0, 0, 64, 64 )
|
||||
margin_left = 20.0
|
||||
margin_right = 20.0
|
||||
margin_top = 20.0
|
||||
margin_bottom = 20.0
|
||||
expand_margin_left = 0.0
|
||||
expand_margin_right = 0.0
|
||||
expand_margin_top = 0.0
|
||||
expand_margin_bottom = 0.0
|
||||
modulate_color = Color( 1, 1, 1, 1 )
|
||||
draw_center = true
|
||||
_sections_unfolded = [ "Margin", "Resource" ]
|
||||
|
||||
[resource]
|
||||
|
||||
default_font = ExtResource( 4 )
|
||||
Button/colors/font_color = Color( 0.686275, 0.741176, 0.768627, 1 )
|
||||
Button/colors/font_color_disabled = Color( 0.686275, 0.741176, 0.768627, 1 )
|
||||
Button/colors/font_color_hover = Color( 1, 1, 1, 1 )
|
||||
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
|
||||
Button/constants/hseparation = 2
|
||||
Button/fonts/font = ExtResource( 1 )
|
||||
Button/styles/disabled = null
|
||||
Button/styles/focus = SubResource( 1 )
|
||||
Button/styles/hover = SubResource( 2 )
|
||||
Button/styles/normal = SubResource( 3 )
|
||||
Button/styles/pressed = SubResource( 4 )
|
||||
Label/colors/font_color = Color( 0.690196, 0.745098, 0.772549, 1 )
|
||||
Label/colors/font_color_shadow = Color( 1, 0.596078, 0, 0 )
|
||||
Label/constants/line_spacing = 3
|
||||
Label/constants/shadow_as_outline = 0
|
||||
Label/constants/shadow_offset_x = 0
|
||||
Label/constants/shadow_offset_y = 4
|
||||
Label/fonts/font = ExtResource( 4 )
|
||||
Label/styles/normal = null
|
||||
Panel/styles/panel = SubResource( 5 )
|
||||
Panel/styles/panelf = null
|
||||
Panel/styles/panelnc = null
|
||||
PanelContainer/styles/panel = SubResource( 5 )
|
||||
ProgressBar/colors/font_color = Color( 0.941176, 0.941176, 0.941176, 1 )
|
||||
ProgressBar/colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
ProgressBar/fonts/font = ExtResource( 4 )
|
||||
ProgressBar/styles/bg = SubResource( 6 )
|
||||
ProgressBar/styles/fg = ExtResource( 7 )
|
||||
_sections_unfolded = [ "Button", "Button/colors", "Label", "Panel/styles", "PanelContainer/styles", "ProgressBar", "ProgressBar/styles" ]
|
||||
|
||||
31
2d/role_playing_game/turn_combat_system/actors/Actor.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends Node
|
||||
|
||||
export (int) var damage = 1
|
||||
export (int) var defense = 1
|
||||
var active = false setget set_active
|
||||
|
||||
signal turn_finished
|
||||
|
||||
func set_active(value):
|
||||
active = value
|
||||
set_process(value)
|
||||
set_process_input(value)
|
||||
|
||||
func attack(target):
|
||||
target.take_damage(damage)
|
||||
emit_signal("turn_finished")
|
||||
|
||||
func defend():
|
||||
$Health.armor += defense
|
||||
emit_signal("turn_finished")
|
||||
|
||||
func consume(item):
|
||||
item.use(self)
|
||||
emit_signal("turn_finished")
|
||||
|
||||
func flee():
|
||||
emit_signal("turn_finished")
|
||||
|
||||
func take_damage(damage):
|
||||
$Health.take_damage(damage)
|
||||
$Sprite/AnimationPlayer.play("take_damage")
|
||||
14
2d/role_playing_game/turn_combat_system/actors/Actor.tscn
Executable file
@@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=3 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]
|
||||
|
||||
[node name="Actor" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
damage = 1
|
||||
defense = 1
|
||||
|
||||
[node name="Health" parent="." index="0" instance=ExtResource( 2 )]
|
||||
|
||||
|
||||
24
2d/role_playing_game/turn_combat_system/actors/health/Health.gd
Executable file
@@ -0,0 +1,24 @@
|
||||
extends Node
|
||||
|
||||
signal dead
|
||||
signal health_changed(life)
|
||||
|
||||
export var life = 0
|
||||
export var max_life = 10
|
||||
export var armor = 0
|
||||
|
||||
|
||||
func take_damage(damage):
|
||||
life = life - damage + armor
|
||||
if life <= 0:
|
||||
emit_signal('dead')
|
||||
else:
|
||||
emit_signal("health_changed", life)
|
||||
|
||||
func heal(amount):
|
||||
life += amount
|
||||
clamp(life, life, max_life)
|
||||
emit_signal("health_changed", life)
|
||||
|
||||
func get_health_ratio():
|
||||
return life / max_life
|
||||
12
2d/role_playing_game/turn_combat_system/actors/health/Health.tscn
Executable file
@@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://turn_combat_system/actors/health/Health.gd" type="Script" id=1]
|
||||
|
||||
[node name="Health" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
life = 0
|
||||
max_life = 10
|
||||
armor = 0
|
||||
|
||||
|
||||
52
2d/role_playing_game/turn_combat_system/turn_queue/TurnQueue.gd
Executable file
@@ -0,0 +1,52 @@
|
||||
extends Node
|
||||
|
||||
const Actor = preload("../actors/Actor.gd")
|
||||
|
||||
export (NodePath) var actors_node
|
||||
var queue = [] setget set_queue
|
||||
var active_actor = null setget _set_active_actor
|
||||
|
||||
signal active_actor_changed(active_actor)
|
||||
|
||||
func _ready():
|
||||
actors_node = get_node(actors_node)
|
||||
initialize()
|
||||
|
||||
func initialize():
|
||||
set_queue(actors_node.get_children())
|
||||
|
||||
func play_turn():
|
||||
yield(active_actor, "turn_finished")
|
||||
get_next_in_queue()
|
||||
play_turn()
|
||||
|
||||
func get_next_in_queue():
|
||||
var current_actor = queue.pop_front()
|
||||
current_actor.active = false
|
||||
queue.append(current_actor)
|
||||
self.active_actor = queue[0]
|
||||
return active_actor
|
||||
|
||||
func remove(actor):
|
||||
var new_queue = []
|
||||
for n in queue:
|
||||
new_queue.append(n)
|
||||
new_queue.remove(new_queue.find(actor))
|
||||
actor.queue_free()
|
||||
self.queue = new_queue
|
||||
|
||||
func set_queue(new_queue):
|
||||
queue.clear()
|
||||
var names = []
|
||||
for node in new_queue:
|
||||
if not node is Actor:
|
||||
continue
|
||||
queue.append(node)
|
||||
node.active = false
|
||||
if queue.size() > 0:
|
||||
self.active_actor = queue[0]
|
||||
|
||||
func _set_active_actor(new_actor):
|
||||
active_actor = new_actor
|
||||
active_actor.active = true
|
||||
emit_signal("active_actor_changed", active_actor)
|
||||
11
2d/role_playing_game/turn_combat_system/turn_queue/TurnQueue.tscn
Executable file
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://turn_combat_system/turn_queue/TurnQueue.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[node name="TurnQueue" type="Node"]
|
||||
|
||||
script = ExtResource( 1 )
|
||||
actors_node = null
|
||||
|
||||
|
||||