Skip to content

Commit 694ee7f

Browse files
authored
Merge pull request #626 from aaronfranke/jrpg-simplify
Vastly simplify the JRPG demo
2 parents 2d4d233 + 6e3db7c commit 694ee7f

File tree

80 files changed

+270
-775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+270
-775
lines changed

2d/role_playing_game/Game.tscn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=5 format=2]
22

33
[ext_resource path="res://Game.gd" type="Script" id=1]
4-
[ext_resource path="res://screens/combat/Combat.tscn" type="PackedScene" id=2]
5-
[ext_resource path="res://screens/exploration/Exploration.tscn" type="PackedScene" id=3]
4+
[ext_resource path="res://combat/Combat.tscn" type="PackedScene" id=2]
5+
[ext_resource path="res://grid_movement/Exploration.tscn" type="PackedScene" id=3]
66

77
[sub_resource type="Animation" id=1]
88
length = 0.5

2d/role_playing_game/screens/combat/Combat.gd renamed to 2d/role_playing_game/combat/Combat.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
extends Node
22

33
signal combat_finished(winner, loser)
4-
const Combatant = preload("res://turn_combat/combatants/Combatant.gd")
54

65
func initialize(combat_combatants):
76
for combatant in combat_combatants:

2d/role_playing_game/screens/combat/Combat.tscn renamed to 2d/role_playing_game/combat/Combat.tscn

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[gd_scene load_steps=7 format=2]
22

3-
[ext_resource path="res://screens/combat/Combat.gd" type="Script" id=1]
4-
[ext_resource path="res://turn_combat/turn_queue/TurnQueue.tscn" type="PackedScene" id=2]
3+
[ext_resource path="res://combat/Combat.gd" type="Script" id=1]
4+
[ext_resource path="res://combat/TurnQueue.gd" type="Script" id=2]
55
[ext_resource path="res://theme/theme.tres" type="Theme" id=3]
6-
[ext_resource path="res://screens/combat/interface/UI.gd" type="Script" id=4]
7-
[ext_resource path="res://screens/combat/interface/Info.tscn" type="PackedScene" id=5]
6+
[ext_resource path="res://combat/interface/UI.gd" type="Script" id=4]
7+
[ext_resource path="res://combat/interface/Info.tscn" type="PackedScene" id=5]
88

99
[sub_resource type="GDScript" id=1]
1010
script/source = "extends Node2D
@@ -21,7 +21,8 @@ script = ExtResource( 1 )
2121
position = Vector2( 539, 275 )
2222
script = SubResource( 1 )
2323

24-
[node name="TurnQueue" parent="." instance=ExtResource( 2 )]
24+
[node name="TurnQueue" type="Node" parent="."]
25+
script = ExtResource( 2 )
2526
combatants_list = NodePath("../Combatants")
2627

2728
[node name="UI" type="Control" parent="."]

2d/role_playing_game/turn_combat/turn_queue/TurnQueue.gd renamed to 2d/role_playing_game/combat/TurnQueue.gd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
extends Node
22

3-
const combatant = preload("../combatants/Combatant.gd")
4-
53
export(NodePath) var combatants_list
64
var queue = [] setget set_queue
75
var active_combatant = null setget _set_active_combatant
@@ -43,7 +41,7 @@ func remove(combatant):
4341
func set_queue(new_queue):
4442
queue.clear()
4543
for node in new_queue:
46-
if not node is combatant:
44+
if not node is Combatant:
4745
continue
4846
queue.append(node)
4947
node.active = false

2d/role_playing_game/turn_combat/combatants/Combatant.gd renamed to 2d/role_playing_game/combat/combatants/Combatant.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
class_name Combatant
12
extends Node
23

34
export(int) var damage = 1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[gd_scene load_steps=4 format=2]
2+
3+
[ext_resource path="res://combat/combatants/Combatant.gd" type="Script" id=1]
4+
[ext_resource path="res://combat/combatants/Health.gd" type="Script" id=2]
5+
[ext_resource path="res://combat/combatants/sprites/Sprite.tscn" type="PackedScene" id=3]
6+
7+
[node name="Combatant" type="Node2D"]
8+
script = ExtResource( 1 )
9+
damage = 2
10+
11+
[node name="Health" type="Node" parent="."]
12+
script = ExtResource( 2 )
13+
life = 10
14+
15+
[node name="Sprite" parent="." instance=ExtResource( 3 )]

2d/role_playing_game/turn_combat/combatants/Opponent.gd renamed to 2d/role_playing_game/combat/combatants/Opponent.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
extends "Combatant.gd"
1+
extends Combatant
22

33
func set_active(value):
44
.set_active(value)
55
if not active:
66
return
77

8+
if not $Timer.is_inside_tree():
9+
return
810
$Timer.start()
911
yield($Timer, "timeout")
1012
var target

2d/role_playing_game/turn_combat/combatants/Opponent.tscn renamed to 2d/role_playing_game/combat/combatants/Opponent.tscn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=4 format=2]
22

3-
[ext_resource path="res://turn_combat/combatants/Combatant.tscn" type="PackedScene" id=1]
4-
[ext_resource path="res://turn_combat/combatants/Opponent.gd" type="Script" id=2]
5-
[ext_resource path="res://turn_combat/combatants/sprites/green.png" type="Texture" id=3]
3+
[ext_resource path="res://combat/combatants/Combatant.tscn" type="PackedScene" id=1]
4+
[ext_resource path="res://combat/combatants/Opponent.gd" type="Script" id=2]
5+
[ext_resource path="res://combat/combatants/sprites/green.png" type="Texture" id=3]
66

77
[node name="Opponent" instance=ExtResource( 1 )]
88
script = ExtResource( 2 )

2d/role_playing_game/turn_combat/combatants/Player.tscn renamed to 2d/role_playing_game/combat/combatants/Player.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=2 format=2]
22

3-
[ext_resource path="res://turn_combat/combatants/Combatant.tscn" type="PackedScene" id=1]
3+
[ext_resource path="res://combat/combatants/Combatant.tscn" type="PackedScene" id=1]
44

55
[node name="Player" instance=ExtResource( 1 )]
66

0 commit comments

Comments
 (0)