Compare commits

..

No commits in common. "master" and "5071247b698d33b63dcbe7834b87776487cc9620" have entirely different histories.

16 changed files with 382 additions and 311 deletions

View File

@ -9,18 +9,12 @@
config_version=4 config_version=4
_global_script_classes=[ { _global_script_classes=[ {
"base": "Node",
"class": "BaseMove",
"language": "GDScript",
"path": "res://src/nodes/moves/BaseMove.gd"
}, {
"base": "Node2D", "base": "Node2D",
"class": "Unit", "class": "Unit",
"language": "GDScript", "language": "GDScript",
"path": "res://src/classes/Unit.gd" "path": "res://src/classes/Unit.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"BaseMove": "",
"Unit": "" "Unit": ""
} }

Binary file not shown.

View File

@ -0,0 +1,10 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://src/assets/title-font.ttf" type="DynamicFontData" id=1]
[sub_resource type="DynamicFont" id=1]
size = 30
font_data = ExtResource( 1 )
[resource]
default_font = SubResource( 1 )

Binary file not shown.

BIN
src/assets/title-font.ttf Normal file

Binary file not shown.

View File

@ -6,7 +6,6 @@ export var unit_type : String
export var max_health : int = 10 export var max_health : int = 10
export var health : int = 10 export var health : int = 10
export var movement_distance : int = 10 export var movement_distance : int = 10
export var attack_limit : int = 20
export var height : int = 0 export var height : int = 0
export var water_walk : bool = false export var water_walk : bool = false
export var air_walk : bool = false export var air_walk : bool = false
@ -27,7 +26,7 @@ onready var Grid = get_node("../Grid")
func start_turn(): func start_turn():
attack_points = attack_limit attack_points = 0
movement_points = movement_distance movement_points = movement_distance
_has_sent_turn_completed = false _has_sent_turn_completed = false
@ -69,6 +68,7 @@ func move(movement : Vector2):
var area_around = Grid.get_around_coordinate(Grid.position_to_coordinates(position, height), i) var area_around = Grid.get_around_coordinate(Grid.position_to_coordinates(position, height), i)
if not area_around.has(Grid.position_to_coordinates(_target_position, _target_height)): if not area_around.has(Grid.position_to_coordinates(_target_position, _target_height)):
movement_points = movement_points - i - 1 movement_points = movement_points - i - 1
print(movement_points)
break break
#change the z_index #change the z_index
@ -76,34 +76,15 @@ func move(movement : Vector2):
z_index = height z_index = height
if (potential_movement[2] == false): #not behind if (potential_movement[2] == false): #not behind
z_index = 100 z_index = 100
yield(get_tree().create_timer(.3), "timeout")
var popup = $Canvas/UnitPopup
popup.popup(Rect2(position.x + 0, position.y - 110, popup.rect_size.x, popup.rect_size.x))
func attack(damage : int, points : int, pattern : PoolVector2Array): func attack(): #TODO
if attack_points != 0: if attack_points == 0:
#change animation to attacking #change animation to attacking
$AnimationPlayer.play("Attack front") #make attacked change to hurt animation
#somehow change health values
#selects all of the units within the attack pattern #maybe using an attacked method??
# and calls their attacked method attack_points = 0
for i in range(pattern.size()):
var coord = Grid.position_to_coordinates(position, height)
var selected_name = Grid.grid[coord.x + pattern[i].x][coord.y + pattern[i].y]
print(coord.x + pattern[i].x, coord.y + pattern[i].y)
if selected_name:
get_node(("../" + selected_name[0])).attacked(damage, "") #TODO effects implementation
#change the attack points left
attack_points = max(attack_points - points, 0) #keep >= 0
func attacked(damage : float, effects : String):
$AnimationPlayer.play("Attacked front")
health -= damage
#probably do some stuff here TODO with death
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
@ -111,20 +92,9 @@ func _physics_process(delta: float) -> void:
position.x = move_toward(position.x, _target_position.x, 800 * delta) position.x = move_toward(position.x, _target_position.x, 800 * delta)
position.y = move_toward(position.y, _target_position.y, 800 * delta) position.y = move_toward(position.y, _target_position.y, 800 * delta)
attack_points = false
if attack_points == 0 && movement_points == 0 && not _has_sent_turn_completed: if attack_points == 0 && movement_points == 0 && not _has_sent_turn_completed:
emit_signal("turn_completed") emit_signal("turn_completed")
_has_sent_turn_completed = true _has_sent_turn_completed = true
func _on_move_selected(move_num) -> void:
#get move properties TODO
var target_move = get_node(("Move" + move_num))
var move_name = target_move.getName()
var move_damage = target_move.getDamage()
var move_points = target_move.getPoints()
var move_pattern = target_move.getPattern()
#run attack function
attack(move_damage, move_points, move_pattern)

View File

@ -1,139 +0,0 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://src/classes/Unit.gd" type="Script" id=1]
[ext_resource path="res://src/assets/shadow.png" type="Texture" id=2]
[ext_resource path="res://src/nodes/UI/UnitPopup.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
resource_name = "Attack back"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacked back"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacked front"
length = 0.9
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=5]
length = 0.9
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.9
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Unit" type="Node2D"]
z_index = 100
script = ExtResource( 1 )
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
"anims/Attacked back" = SubResource( 4 )
"anims/Attacked front" = SubResource( 3 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )
[node name="Canvas" type="CanvasLayer" parent="."]
[node name="UnitPopup" parent="Canvas" instance=ExtResource( 3 )]
margin_right = 40.0
margin_bottom = 88.0
[connection signal="move_selected" from="Canvas/UnitPopup" to="." method="_on_move_selected"]

View File

@ -1,8 +0,0 @@
extends PopupPanel
signal move_selected(move_num)
func _move_selected(move_num: int) -> void:
print(move_num)
hide()
emit_signal("move_selected", move_num)

View File

@ -1,71 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/assets/theme.theme" type="Theme" id=1]
[ext_resource path="res://src/nodes/UI/UnitPopup.gd" type="Script" id=2]
[node name="PopupMenu" type="PopupPanel"]
margin_right = 39.0
margin_bottom = 97.0
theme = ExtResource( 1 )
script = ExtResource( 2 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -16.0
margin_top = -44.5
margin_right = 16.0
margin_bottom = 44.5
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer"]
margin_top = 4.0
margin_right = 32.0
margin_bottom = 12.0
text = "Health"
align = 1
[node name="Label2" type="Label" parent="VBoxContainer"]
margin_top = 16.0
margin_right = 32.0
margin_bottom = 24.0
text = "Damage"
align = 1
[node name="Move0" type="Button" parent="VBoxContainer"]
margin_top = 76.0
margin_right = 32.0
margin_bottom = 84.0
text = "Move 0"
[node name="Move1" type="Button" parent="VBoxContainer"]
margin_top = 28.0
margin_right = 32.0
margin_bottom = 36.0
text = "Move 1"
[node name="Move2" type="Button" parent="VBoxContainer"]
margin_top = 40.0
margin_right = 32.0
margin_bottom = 48.0
text = "Move 2"
[node name="Move3" type="Button" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 32.0
margin_bottom = 60.0
text = "Move 3"
[node name="Move4" type="Button" parent="VBoxContainer"]
margin_top = 64.0
margin_right = 32.0
margin_bottom = 72.0
text = "Move 4"
[connection signal="pressed" from="VBoxContainer/Move0" to="." method="_move_selected" binds= [ 0 ]]
[connection signal="pressed" from="VBoxContainer/Move1" to="." method="_move_selected" binds= [ 1 ]]
[connection signal="pressed" from="VBoxContainer/Move2" to="." method="_move_selected" binds= [ 2 ]]
[connection signal="pressed" from="VBoxContainer/Move3" to="." method="_move_selected" binds= [ 3 ]]
[connection signal="pressed" from="VBoxContainer/Move4" to="." method="_move_selected" binds= [ 4 ]]

View File

@ -1,16 +0,0 @@
extends Node
class_name BaseMove
export var title : String = "Move"
export var power : int = 0
export (String,
"Normal", "Fire", "Water",
"Grass", "Sound") var type : String = "Normal" #TODEC
export (int, "Physical", "Special", "Status") var catagory : int #TODEC
export var accuracy : int = 100 #TODEC
export var makes_contact : bool = false #TODEC
export var points : int = 3
export var effect1 : String
export var effect2 : String
export var effect3 : String
export (String, MULTILINE) var description : String

View File

@ -1,6 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/nodes/moves/BaseMove.gd" type="Script" id=1]
[node name="BaseMove" type="Node"]
script = ExtResource( 1 )

View File

@ -1,8 +1,134 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://src/classes/Unit.tscn" type="PackedScene" id=1] [ext_resource path="res://src/assets/shadow.png" type="Texture" id=1]
[ext_resource path="res://src/nodes/units/Foe.gd" type="Script" id=2] [ext_resource path="res://src/nodes/units/Foe.gd" type="Script" id=2]
[node name="Foe" groups=["foes"] instance=ExtResource( 1 )] [sub_resource type="Animation" id=1]
resource_name = "Attack back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacted"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacted back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=5]
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Foe" type="Node2D" groups=[
"foes",
]]
script = ExtResource( 2 ) script = ExtResource( 2 )
unit_type = "Foe" unit_type = "Foe"
movement_distance = 0
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
frame = 12
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
anims/Attacted = SubResource( 3 )
"anims/Attacted back" = SubResource( 4 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )

View File

@ -1,8 +1,133 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://src/classes/Unit.tscn" type="PackedScene" id=1] [ext_resource path="res://src/assets/shadow.png" type="Texture" id=2]
[ext_resource path="res://src/nodes/units/Friend.gd" type="Script" id=3] [ext_resource path="res://src/nodes/units/Friend.gd" type="Script" id=3]
[node name="Friend" groups=["friends"] instance=ExtResource( 1 )] [sub_resource type="Animation" id=1]
resource_name = "Attack back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 12, 13, 14, 15, 14, 13 ]
}
[sub_resource type="Animation" id=2]
resource_name = "Attack front"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 8, 9, 10, 11, 10, 9 ]
}
[sub_resource type="Animation" id=3]
resource_name = "Attacted"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 16, 17, 18, 19, 18, 17 ]
}
[sub_resource type="Animation" id=4]
resource_name = "Attacted back"
length = 0.8
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 20, 21, 22, 23, 22, 21 ]
}
[sub_resource type="Animation" id=5]
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 2, 1 ]
}
[sub_resource type="Animation" id=6]
resource_name = "Idle back"
length = 0.8
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.15, 0.3, 0.45, 0.6, 0.75 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 4, 5, 6, 7, 6, 5 ]
}
[node name="Friend" type="Node2D" groups=[
"friends",
]]
z_index = 100
script = ExtResource( 3 ) script = ExtResource( 3 )
unit_type = "Friend" unit_type = "Friend"
[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 2.5, -8.5 )
scale = Vector2( 1.28125, 0.90625 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 2, -12 )
hframes = 4
vframes = 6
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Idle"
"anims/Attack back" = SubResource( 1 )
"anims/Attack front" = SubResource( 2 )
anims/Attacted = SubResource( 3 )
"anims/Attacted back" = SubResource( 4 )
anims/Idle = SubResource( 5 )
"anims/Idle back" = SubResource( 6 )

View File

@ -172,7 +172,6 @@ func position_to_coordinates (node_position : Vector2, height : int) -> Vector2:
return out return out
func _is_in_grid (coordinates : Vector2) -> bool: func _is_in_grid (coordinates : Vector2) -> bool:
if (coordinates.x >= GRID_SIZE.x or if (coordinates.x >= GRID_SIZE.x or
coordinates.y >= GRID_SIZE.y or coordinates.y >= GRID_SIZE.y or
@ -181,7 +180,6 @@ func _is_in_grid (coordinates : Vector2) -> bool:
return false return false
return true return true
func get_tile_behind_state (coordinates : Vector2) -> String: func get_tile_behind_state (coordinates : Vector2) -> String:
#checking if tiles are directly behind #checking if tiles are directly behind
#the plus 1 and plus 2 mean that its a height difference of 2 or 3 required respectively #the plus 1 and plus 2 mean that its a height difference of 2 or 3 required respectively
@ -202,8 +200,7 @@ func get_tile_behind_state (coordinates : Vector2) -> String:
else: else:
return "n" #no return "n" #no
func get_around_coordinate(coordinate : Vector2, movement_distance : int):
func get_around_coordinate (coordinate : Vector2, movement_distance : int):
#found https://godotengine.org/qa/64496/how-to-get-a-random-tile-in-a-radious #found https://godotengine.org/qa/64496/how-to-get-a-random-tile-in-a-radious
#disclude the tile being stood on #disclude the tile being stood on
@ -231,8 +228,7 @@ func get_around_coordinate (coordinate : Vector2, movement_distance : int):
return positions return positions
func _filter_moveable_spaces(positions_array, water_walk : bool = false, air_walk : bool = false, lava_walk : bool = false):
func _filter_moveable_spaces (positions_array, water_walk : bool = false, air_walk : bool = false, lava_walk : bool = false):
#this uses happy path to filter out the invalid move spaces #this uses happy path to filter out the invalid move spaces
var new_pos_array = [] var new_pos_array = []
for i in positions_array.size(): for i in positions_array.size():
@ -256,8 +252,7 @@ func _filter_moveable_spaces (positions_array, water_walk : bool = false, air_wa
new_pos_array.append(positions_array[i]) new_pos_array.append(positions_array[i])
return new_pos_array return new_pos_array
func display_selection(coordinate : Vector2, unit : Unit):
func display_selection (coordinate : Vector2, unit : Unit):
var movement_amount = unit.movement_points var movement_amount = unit.movement_points
print("hi") print("hi")
for i in range (movement_amount, -1, -1): for i in range (movement_amount, -1, -1):
@ -273,17 +268,16 @@ func display_selection (coordinate : Vector2, unit : Unit):
var area_moveable = _filter_moveable_spaces(area_around, unit.water_walk, unit.air_walk, unit.lava_walk) var area_moveable = _filter_moveable_spaces(area_around, unit.water_walk, unit.air_walk, unit.lava_walk)
$SelectionAreaController.create_selection_from_array(area_moveable, i) $SelectionAreaController.create_selection_from_array(area_moveable, i)
func remove_selection():
func remove_selection ():
$SelectionAreaController.emit_signal("remove_selection") $SelectionAreaController.emit_signal("remove_selection")
#func get_around_coordinate(coordinate : Vector2, movement_distance : int): #func get_around_coordinate(coordinate : Vector2, movement_distance : int):
# #this generates the list of coordinates that a unit can move too # #this generates the list of coordinates that a unit can move too
# #the radius + radius (either side) + 1 (the center) # #the radius + radius (either side) + 1 (the center)

View File

@ -0,0 +1,87 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/assets/global_theme.tres" type="Theme" id=1]
[sub_resource type="Animation" id=1]
resource_name = "Loading"
length = 2.0
step = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Label:text")
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, 1, 1.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ "Loading", "Loading.", "Loading..", "Loading..." ]
}
tracks/1/type = "method"
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 2 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "queue_free"
} ]
}
[node name="LoadingScreen" type="CanvasLayer"]
[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
color = Color( 0.258824, 0.643137, 0.34902, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -240.0
margin_top = -52.0
margin_right = 240.0
margin_bottom = -19.0
theme = ExtResource( 1 )
text = "Loading"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Loading"
anims/Loading = SubResource( 1 )
[node name="Timers" type="Node" parent="."]
[node name="Timer" type="Timer" parent="Timers"]
wait_time = 0.5
one_shot = true
autostart = true
[node name="Timer2" type="Timer" parent="Timers"]
one_shot = true
autostart = true
[node name="Timer3" type="Timer" parent="Timers"]
wait_time = 1.5
one_shot = true
autostart = true
[node name="Timer4" type="Timer" parent="Timers"]
wait_time = 2.0
one_shot = true
autostart = true

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=10 format=2]
[ext_resource path="res://src/assets/isometric_tileset/isometric_tileset.tres" type="TileSet" id=1] [ext_resource path="res://src/assets/isometric_tileset/isometric_tileset.tres" type="TileSet" id=1]
[ext_resource path="res://src/nodes/units/Friend.tscn" type="PackedScene" id=2] [ext_resource path="res://src/nodes/units/Friend.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/nodes/world/Cursor.tscn" type="PackedScene" id=3] [ext_resource path="res://src/nodes/world/Cursor.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/nodes/world/Grid.tscn" type="PackedScene" id=4] [ext_resource path="res://src/nodes/world/Grid.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/nodes/world/LoadingScreen.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/assets/TEST-ANIMATION.png" type="Texture" id=6] [ext_resource path="res://src/assets/TEST-ANIMATION.png" type="Texture" id=6]
[ext_resource path="res://icon.png" type="Texture" id=7] [ext_resource path="res://icon.png" type="Texture" id=7]
[ext_resource path="res://src/nodes/world/BattleController.tscn" type="PackedScene" id=8] [ext_resource path="res://src/nodes/world/BattleController.tscn" type="PackedScene" id=8]
@ -73,3 +74,7 @@ sprite = ExtResource( 7 )
[node name="Grid" parent="." instance=ExtResource( 4 )] [node name="Grid" parent="." instance=ExtResource( 4 )]
[node name="BattleController" parent="." instance=ExtResource( 8 )] [node name="BattleController" parent="." instance=ExtResource( 8 )]
[node name="LoadingScreen" parent="." instance=ExtResource( 5 )]
scale = Vector2( 0.001, 0.001 )
transform = Transform2D( 0.001, 0, 0, 0.001, 0, 0 )