More spells and started on cast indicator
This commit is contained in:
parent
68b9c040ad
commit
a440a60383
@ -1,14 +1,15 @@
|
||||
[gd_resource type="Resource" script_class="Spellbook" load_steps=4 format=3 uid="uid://bxtiv2esuer8v"]
|
||||
[gd_resource type="Resource" script_class="Spellbook" load_steps=5 format=3 uid="uid://bxtiv2esuer8v"]
|
||||
|
||||
[ext_resource type="Script" path="res://Resources/spellbook.gd" id="1_t8h8m"]
|
||||
[ext_resource type="Resource" uid="uid://1xbik4qndtkh" path="res://Resources/Spells/firebolt.tres" id="2_ln222"]
|
||||
[ext_resource type="Resource" uid="uid://dl6nv6lp460n3" path="res://Resources/Spells/rockThrow.tres" id="3_ocgmh"]
|
||||
[ext_resource type="Resource" uid="uid://bmpu6k55bckdv" path="res://Resources/Spells/fireball.tres" id="4_kv0hs"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_t8h8m")
|
||||
name = "Old Book"
|
||||
description = "An old spellbook you found on the side of the road"
|
||||
spells = Array[Resource("res://Resources/spell.gd")]([ExtResource("2_ln222"), ExtResource("3_ocgmh"), null])
|
||||
spells = Array[Resource("res://Resources/spell.gd")]([ExtResource("2_ln222"), ExtResource("3_ocgmh"), ExtResource("4_kv0hs")])
|
||||
damageMod = 1.0
|
||||
defenseMod = 1.0
|
||||
element = 0
|
||||
|
12
Resources/Spellbooks/wizardSpellbook.tres
Normal file
12
Resources/Spellbooks/wizardSpellbook.tres
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="Spellbook" load_steps=2 format=3 uid="uid://g86hap7s43n8"]
|
||||
|
||||
[ext_resource type="Script" path="res://Resources/spellbook.gd" id="1_pn4te"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_pn4te")
|
||||
name = "Wizard Spellbook"
|
||||
description = "A spellbook used by wizards"
|
||||
spells = Array[Resource("res://Resources/spell.gd")]([null, null, null, null, null, null])
|
||||
damageMod = 1.2
|
||||
defenseMod = 1.2
|
||||
element = 0
|
19
Resources/Spells/fireball.tres
Normal file
19
Resources/Spells/fireball.tres
Normal file
@ -0,0 +1,19 @@
|
||||
[gd_resource type="Resource" script_class="Spell" load_steps=3 format=3 uid="uid://bmpu6k55bckdv"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c3e14oly7elf3" path="res://Sprites/Spells/Ice & Fire Spells Pack by Captainskeleto/Fire Spell Pack by Captainskeleto/Fire Spells/Fire Spell Pack52.png" id="1_8gs1u"]
|
||||
[ext_resource type="Script" path="res://Resources/spell.gd" id="1_iewgb"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_iewgb")
|
||||
icon = ExtResource("1_8gs1u")
|
||||
name = "Fireball"
|
||||
description = "An enourmous ball of fire"
|
||||
animation = ""
|
||||
damage = 8.0
|
||||
backfireStrength = 6.0
|
||||
castCombo = Array[String](["up", "down", "down", "left", "right", "left", "right", "up"])
|
||||
castProgress = 0
|
||||
element = 1
|
||||
stunning = true
|
||||
timeout = 5.0
|
||||
cooldown = 10.0
|
@ -10,6 +10,10 @@ name = "Firebolt"
|
||||
description = "Cast a small line of fire at your opponent"
|
||||
animation = ""
|
||||
damage = 1.0
|
||||
backfireStrength = 1.0
|
||||
castCombo = Array[String](["up", "down", "down"])
|
||||
castProgress = 0
|
||||
element = 1
|
||||
stunning = false
|
||||
timeout = 10.0
|
||||
cooldown = 1.0
|
||||
|
@ -10,6 +10,10 @@ name = "Rock Throw"
|
||||
description = "Throw a rock at your opponent"
|
||||
animation = ""
|
||||
damage = 0.5
|
||||
backfireStrength = 1.0
|
||||
castCombo = Array[String](["down", "up", "up"])
|
||||
castProgress = 0
|
||||
element = 4
|
||||
stunning = true
|
||||
timeout = 10.0
|
||||
cooldown = 1.0
|
||||
|
46
Scenes/UI/castIndicator.tscn
Normal file
46
Scenes/UI/castIndicator.tscn
Normal file
@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dbhep5cgrqipa"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://1duikwr2bln8" path="res://Sprites/Misc/WEAPON PACK by captainskeleto/weapon9.png" id="1_25tp1"]
|
||||
[ext_resource type="Script" path="res://Scripts/castIndicator.gd" id="1_jkb2f"]
|
||||
|
||||
[node name="CastIndicator" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_jkb2f")
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="."]
|
||||
modulate = Color(1, 1, 1, 0.345098)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -94.0
|
||||
offset_top = -94.0
|
||||
offset_right = 94.0
|
||||
offset_bottom = 94.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_25tp1")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_25tp1")
|
13
Scripts/castIndicator.gd
Normal file
13
Scripts/castIndicator.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Control
|
||||
|
||||
@onready var data = get_node("/root/Arena/Data")
|
||||
@onready var primary = $TextureRect
|
||||
@onready var secondary = $TextureRect2
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
@ -1,9 +1,11 @@
|
||||
extends Node
|
||||
|
||||
@onready var data = get_node("/root/Arena/Data")
|
||||
@onready var castIndicator = get_node("/root/Arena/CanvasLayer/CastIndicator")
|
||||
@export var avatar: Combatant
|
||||
var casting = false
|
||||
var spell: Spell
|
||||
var spellIndex: int
|
||||
var timer: float = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@ -14,9 +16,10 @@ func _ready():
|
||||
func _process(delta):
|
||||
if !casting:
|
||||
for i in range(data.spellbook.spells.size()):
|
||||
if Input.is_action_just_pressed("Spell" + str(i)):
|
||||
if Input.is_action_just_pressed("Spell" + str(i)) && data.spellbook.cooldowns[i] == 0:
|
||||
casting = true
|
||||
spell = data.spellbook.spells[i]
|
||||
spellIndex = i
|
||||
avatar.particleSystem.emitting = true
|
||||
timer = 0
|
||||
else:
|
||||
@ -28,8 +31,13 @@ func _process(delta):
|
||||
avatar.particleSystem.emitting = false
|
||||
spell.castProgress = 0
|
||||
avatar.renderer.play("attack1")
|
||||
data.spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
elif (timer >= spell.timeout || Input.is_action_just_pressed("up") || Input.is_action_just_pressed("down") || Input.is_action_just_pressed("left") || Input.is_action_just_pressed("right")):
|
||||
avatar.alterHealth(-spell.backfireStrength, true)
|
||||
casting = false
|
||||
avatar.particleSystem.emitting = false
|
||||
|
||||
data.spellbook.cooldowns[spellIndex] = spell.cooldown * (spell.castProgress / spell.castCombo.size())
|
||||
|
||||
for i in range(data.spellbook.cooldowns.size()):
|
||||
data.spellbook.cooldowns[i] -= delta
|
||||
if data.spellbook.cooldowns[i] < 0: data.spellbook.cooldowns[i] = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user