Skip to content

Commit

Permalink
cleanup incongruences between versions
Browse files Browse the repository at this point in the history
  • Loading branch information
salvob41 committed Nov 20, 2018
1 parent 7b7aa86 commit 2320158
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 123 deletions.
26 changes: 4 additions & 22 deletions godot/Game.gd
Original file line number Diff line number Diff line change
@@ -1,42 +1,24 @@
extends Node

var combat_arena = preload("res://combat/CombatArena.tscn").instance()
<<<<<<< HEAD
var local_map = preload("res://local_map/map.tscn").instance()
var party = preload("res://Party.tscn").instance()
=======
>>>>>>> fa807e1... add local map and transition from it to combat

onready var transition = $Overlays/TransitionColor
onready var local_map = get_node("local_map")

<<<<<<< HEAD


func _ready():
#enter_battle("res://combat/battlers/formations/PorcupineFormation001.tscn")
pass
=======
func _ready():
#enter_battle("res://combat/battlers/formations/PorcupineFormation001.tscn")
#enter_battle()
local_map.visible = true
>>>>>>> fa807e1... add local map and transition from it to combat


func enter_battle(formation_name : String):
"""
Plays the combat transition animation and initializes the combat scene
"""
remove_child(get_node("local_map"))
add_child(combat_arena)
yield(transition.fade_to_color(), "completed")
<<<<<<< HEAD
var formation: Formation = load(formation_name).instance()
combat_arena.initialize(formation, party)
=======
local_map.visible = false
add_child(combat_arena)
>>>>>>> fa807e1... add local map and transition from it to combat
yield(get_tree().create_timer(0.8), "timeout")
combat_arena.initialize()
combat_arena.initialize()
yield(transition.fade_from_color(), "completed")
combat_arena.battle_start()
35 changes: 3 additions & 32 deletions godot/combat/CombatArena.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ onready var interface = $CombatInterface

var active : bool = false

func initialize(formation : Formation, party : Party):
ready_field(formation, party)

# reparent the enemy battlers into the turn queue
func initialize():
var battlers = turn_queue.get_battlers()
interface.initialize(battlers)
turn_queue.initialize()
turn_queue.initialize()

func battle_start():
active = true
yield(play_intro(), "completed")
Expand All @@ -29,32 +26,6 @@ func play_intro():
yield(get_tree().create_timer(0.15), "timeout")
yield(get_tree().create_timer(0.8), "timeout")

func ready_field(formation : Formation, party : Party):
"""
use a formation as a factory for the scene's content
"""
var spawn_positions = $SpawnPositions/Monsters
for enemy in formation.get_children():
# spawn a platform where the enemy is supposed to stand
var platform = formation.platform_template.instance()
platform.position = enemy.position
spawn_positions.add_child(platform)
var combatant = enemy.duplicate()
turn_queue.add_child(combatant)

var party_spawn_positions = $SpawnPositions/Party
var party_members = party.get_members()
for i in len(party_members):
var party_member = party_members[i].duplicate()
var platform = formation.platform_template.instance()
var spawn_point = party_spawn_positions.get_child(i)
platform.position = spawn_point.position
party_member.position = spawn_point.position
spawn_point.replace_by(platform)
turn_queue.add_child(party_member)

formation.queue_free()

func battle_end():
active = false
var player_lost = get_active_battler().party_member
Expand Down
93 changes: 26 additions & 67 deletions godot/combat/CombatArena.tscn
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=11 format=2]

[ext_resource path="res://combat/CombatArena.gd" type="Script" id=1]
[ext_resource path="res://combat/turn_queue/TurnQueue.tscn" type="PackedScene" id=2]
[ext_resource path="res://combat/interface/CombatInterface.gd" type="Script" id=3]
[ext_resource path="res://combat/interface/SelectArrow.tscn" type="PackedScene" id=4]
[ext_resource path="res://interface/default.theme" type="Theme" id=5]
[ext_resource path="res://combat/interface/OldSchoolUI.gd" type="Script" id=6]
[ext_resource path="res://combat/interface/lifebar/LifebarsBuilder.tscn" type="PackedScene" id=7]
[ext_resource path="res://combat/background/StonePlatform.tscn" type="PackedScene" id=2]
[ext_resource path="res://combat/turn_queue/TurnQueue.tscn" type="PackedScene" id=3]
[ext_resource path="res://combat/battlers/PorcupineBattler.tscn" type="PackedScene" id=4]
[ext_resource path="res://combat/battlers/BlueBattler.tscn" type="PackedScene" id=5]
[ext_resource path="res://combat/battlers/DanBattler.tscn" type="PackedScene" id=6]
[ext_resource path="res://combat/interface/CombatInterface.gd" type="Script" id=7]
[ext_resource path="res://combat/interface/SelectArrow.tscn" type="PackedScene" id=8]
[ext_resource path="res://interface/default.theme" type="Theme" id=9]
[ext_resource path="res://combat/interface/lifebar/LifebarsBuilder.tscn" type="PackedScene" id=10]

[node name="CombatArena" type="Node2D"]
script = ExtResource( 1 )

[node name="SpawnPositions" type="Node" parent="."]
editor/display_folded = true

[node name="Monsters" type="Node" parent="SpawnPositions"]

[node name="1" parent="SpawnPositions/Monsters" instance=ExtResource( 2 )]
position = Vector2( 746, 357.096 )

[node name="2" parent="SpawnPositions/Monsters" instance=ExtResource( 2 )]
position = Vector2( 426, 517.096 )

[node name="3" parent="SpawnPositions/Monsters" instance=ExtResource( 2 )]
position = Vector2( 618, 776.096 )

[node name="Party" type="Node" parent="SpawnPositions"]

[node name="1" type="Position2D" parent="SpawnPositions/Party"]
[node name="1" parent="SpawnPositions/Party" instance=ExtResource( 2 )]
position = Vector2( 1285.1, 453.096 )

[node name="2" type="Position2D" parent="SpawnPositions/Party"]
[node name="2" parent="SpawnPositions/Party" instance=ExtResource( 2 )]
position = Vector2( 1376, 672 )

[node name="TurnQueue" parent="." instance=ExtResource( 2 )]
[node name="TurnQueue" parent="." instance=ExtResource( 3 )]
z_index = 10
<<<<<<< HEAD

[node name="CombatInterface" type="CanvasLayer" parent="."]
layer = 100
offset = Vector2( 0, 0 )
rotation = 0.0
scale = Vector2( 1, 1 )
transform = Transform2D( 1, 0, 0, 1, 0, 0 )
script = ExtResource( 3 )
=======

[node name="Porcupine" parent="TurnQueue" instance=ExtResource( 4 )]
position = Vector2( 746, 357.096 )
Expand All @@ -56,29 +59,18 @@ party_member = true
[node name="CombatInterface" type="CanvasLayer" parent="."]
layer = 100
script = ExtResource( 7 )
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="SelectArrow" parent="CombatInterface" instance=ExtResource( 4 )]
[node name="SelectArrow" parent="CombatInterface" instance=ExtResource( 8 )]
position = Vector2( -39, -51 )

[node name="OldSchoolUI" type="Control" parent="CombatInterface"]
editor/display_folded = true
visible = false
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -186.0
<<<<<<< HEAD
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( 5 )
script = ExtResource( 6 )
=======
theme = ExtResource( 9 )
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="Row" type="HBoxContainer" parent="CombatInterface/OldSchoolUI"]
anchor_right = 1.0
Expand All @@ -90,27 +82,13 @@ margin_bottom = 186.0
size_flags_horizontal = 3

[node name="Column" type="VBoxContainer" parent="CombatInterface/OldSchoolUI/Row/MonstersPanel"]
<<<<<<< HEAD
anchor_left = 0.0
anchor_top = 0.0
=======
editor/display_folded = true
>>>>>>> fa807e1... add local map and transition from it to combat
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = -20.0
<<<<<<< HEAD
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="MonsterWidget" type="HBoxContainer" parent="CombatInterface/OldSchoolUI/Row/MonstersPanel/Column"]
margin_right = 594.0
Expand Down Expand Up @@ -146,7 +124,6 @@ margin_bottom = 23.0
size_flags_horizontal = 3
text = "85/120"
align = 2
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="PartyPanel" type="Panel" parent="CombatInterface/OldSchoolUI/Row"]
margin_left = 650.0
Expand All @@ -158,34 +135,16 @@ size_flags_stretch_ratio = 2.0
[node name="Column" type="VBoxContainer" parent="CombatInterface/OldSchoolUI/Row/PartyPanel"]
margin_right = 40.0
margin_bottom = 40.0
<<<<<<< HEAD
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
=======
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="Control" type="Control" parent="CombatInterface/OldSchoolUI/Row/PartyPanel/Column"]
margin_right = 40.0
size_flags_horizontal = 3
<<<<<<< HEAD
size_flags_vertical = 1
=======
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="HSeparator" type="HSeparator" parent="CombatInterface/OldSchoolUI/Row/PartyPanel/Column"]
margin_top = 16.0
margin_right = 40.0
margin_bottom = 20.0
size_flags_horizontal = 3
<<<<<<< HEAD
size_flags_vertical = 1
=======
>>>>>>> fa807e1... add local map and transition from it to combat

[node name="LifebarsBuilder" parent="CombatInterface" instance=ExtResource( 7 )]
[node name="LifebarsBuilder" parent="CombatInterface" instance=ExtResource( 10 )]

2 changes: 0 additions & 2 deletions godot/combat/interface/CombatInterface.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
extends CanvasLayer

onready var lifebar_builder = $LifebarsBuilder
onready var oldschool_ui = $OldSchoolUI
onready var select_arrow = $SelectArrow

func initialize(battlers : Array):
lifebar_builder.initialize(battlers)
oldschool_ui.initialize(battlers)

func select_target(selectable_battlers : Array) -> Battler:
var selected_target : Battler = yield(select_arrow.select_target(selectable_battlers), "completed")
Expand Down

0 comments on commit 2320158

Please sign in to comment.