Ver Fonte

Fix typos and add missing end lines JRPG demo

Nathan Lovato há 7 anos atrás
pai
commit
471b813911

+ 0 - 0
2d/role_playing_game/dialog_system/dialog_player/dialog_player.gd → 2d/role_playing_game/dialog_system/dialog_player/DialogPlayer.gd


+ 2 - 1
2d/role_playing_game/dialog_system/dialog_player/DialogPlayer.tscn

@@ -1,6 +1,7 @@
 [gd_scene load_steps=2 format=2]
 
-[ext_resource path="res://dialog_system/dialog_player/dialog_player.gd" type="Script" id=1]
+[ext_resource path="res://dialog_system/dialog_player/DialogPlayer.gd" type="Script" id=1]
+
 
 
 [node name="DialogPlayer" type="Node"]

+ 2 - 2
2d/role_playing_game/dialog_system/dialogs/npc_01.json

@@ -1,5 +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!"},
+  "dialog_2" : {"name": "Unknown", "text": "Let me introduce myself, I'm the OPPONENT"},
+  "dialog_3" : {"name": "Opponent", "text": "Enough talking. Let's fight!"},
 }

+ 0 - 1
2d/role_playing_game/dialog_system/dialogs/player_lose.json

@@ -1,4 +1,3 @@
 {
   "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..."},
 }

+ 0 - 1
2d/role_playing_game/dialog_system/dialogs/player_won.json

@@ -1,4 +1,3 @@
 {
   "dialog_1" : {"name": "Opponent", "text": "Congratulations, you won!"},
-  "dialog_2" : {"name": "Opponent", "text": "Now let me wonder around again..."},
 }

+ 0 - 3
2d/role_playing_game/grid_movement/grid/grid.gd

@@ -7,7 +7,6 @@ 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:
@@ -15,7 +14,6 @@ func get_cell_pawn(cell, type = ACTOR):
 		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
@@ -33,4 +31,3 @@ func request_move(pawn, direction):
 			if not target_pawn.has_node("DialogPlayer"):
 				return
 			get_node(dialog_ui).show_dialog(pawn, target_pawn.get_node("DialogPlayer"))
-			

+ 0 - 0
2d/role_playing_game/grid_movement/pawns/idle_actor.gd → 2d/role_playing_game/grid_movement/pawns/IdleActor.gd


+ 0 - 0
2d/role_playing_game/grid_movement/pawns/random_actor.gd → 2d/role_playing_game/grid_movement/pawns/RandomActor.gd


+ 1 - 1
2d/role_playing_game/screens/combat/Combat.tscn

@@ -50,7 +50,7 @@ func add_actor(actor):
 	actor.position.x += 200 * get_child_count()
 	add_child(actor)"
 
-[node name="Combat" type="Node2D"]
+[node name="Combat" type="Node2D" index="0"]
 
 script = SubResource( 1 )
 

+ 4 - 2
2d/role_playing_game/screens/exploration/Exploration.tscn

@@ -2,15 +2,17 @@
 
 [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/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://grid_movement/pawns/IdleActor.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"]

+ 4 - 4
2d/role_playing_game/turn_combat_system/actors/health/Health.gd

@@ -7,10 +7,10 @@ export var life = 0
 export var max_life = 10
 export var armor = 0
 
-
 func take_damage(damage):
-	life = life - damage + armor
-	if life <= 0:
+	var applied_damage = max(damage - armor, 0)
+	life = max(life - applied_damage, 0)
+	if life == 0:
 		emit_signal('dead')
 	else:
 		emit_signal("health_changed", life)
@@ -21,4 +21,4 @@ func heal(amount):
 	emit_signal("health_changed", life)
 
 func get_health_ratio():
-	return life / max_life
+	return life / max_life

+ 1 - 1
2d/role_playing_game/turn_combat_system/turn_queue/TurnQueue.gd

@@ -49,4 +49,4 @@ func set_queue(new_queue):
 func _set_active_actor(new_actor):
 	active_actor = new_actor
 	active_actor.active = true
-	emit_signal("active_actor_changed", active_actor)
+	emit_signal("active_actor_changed", active_actor)