Player stores scene
This commit is contained in:
parent
6c3432ab13
commit
8cc87c4b14
|
@ -1,13 +1,15 @@
|
|||
extends Node
|
||||
|
||||
var position: Vector2 = Vector2()
|
||||
var health: float = -1
|
||||
var energy: float = -1
|
||||
var health = null
|
||||
var energy = null
|
||||
var unlocked: Array = [Globals.Conduit2]
|
||||
var current_scene: PackedScene
|
||||
|
||||
func respawn():
|
||||
health = -1
|
||||
energy = -1
|
||||
health = null
|
||||
energy = null
|
||||
|
||||
func reset_magic():
|
||||
unlocked = []
|
||||
|
||||
|
|
16
magic/Beams/Beam.gd
Normal file
16
magic/Beams/Beam.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Node2D
|
||||
class_name Beam
|
||||
|
||||
var max_cast = Vector2(400, 0)
|
||||
|
||||
onready var Beam: Sprite = $Beam
|
||||
onready var Begin: Sprite = $Begin
|
||||
onready var Ray: RayCast2D = $Raycast2D
|
||||
onready var End: Position2D = $End
|
||||
|
||||
func _physics_process(delta):
|
||||
Ray.cast_to = max_cast
|
||||
if Ray.is_colliding():
|
||||
End.global_position = Ray.get_collision_point()
|
||||
else:
|
||||
End.position = max_cast
|
|
@ -17,6 +17,6 @@ region_rect = Rect2( 0, 0, 8, 8 )
|
|||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||
enabled = true
|
||||
cast_to = Vector2( 100, 0 )
|
||||
cast_to = Vector2( 400, 0 )
|
||||
|
||||
[node name="End" type="Position2D" parent="."]
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Node2D",
|
||||
"class": "Beam",
|
||||
"language": "GDScript",
|
||||
"path": "res://magic/Beams/Beam.gd"
|
||||
}, {
|
||||
"base": "Area2D",
|
||||
"class": "Collectable",
|
||||
"language": "GDScript",
|
||||
|
@ -40,6 +45,7 @@ _global_script_classes=[ {
|
|||
"path": "res://magic/Wands/WandClass.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Beam": "",
|
||||
"Collectable": "",
|
||||
"Enemy": "",
|
||||
"EnemyProjectile": "",
|
||||
|
|
|
@ -10,10 +10,9 @@ var energy = 5 setget set_energy, get_energy
|
|||
var is_burnout = false
|
||||
|
||||
func _ready():
|
||||
print(Player.energy)
|
||||
if Player.health == -1:
|
||||
if Player.health == null:
|
||||
Player.health = Hearts.max_value
|
||||
if Player.energy == -1:
|
||||
if Player.energy == null:
|
||||
Player.energy = Energybar.max_value
|
||||
print("max")
|
||||
set_health(Player.health)
|
||||
|
@ -25,6 +24,10 @@ func _on_Regen_timeout():
|
|||
is_burnout = false
|
||||
|
||||
func _process(delta):
|
||||
if Player.health == null:
|
||||
Player.health = Hearts.max_value
|
||||
if Player.energy == null:
|
||||
Player.energy = Energybar.max_value
|
||||
if get_accurate_energy() < Energybar.max_value and Regen.is_stopped():
|
||||
Regen.start()
|
||||
BurnoutSprite.visible = is_burnout
|
||||
|
|
Loading…
Reference in a new issue