Energy burnout finished
This commit is contained in:
parent
1156886ca8
commit
d525377e03
|
@ -8,11 +8,7 @@ radius = 5.0
|
|||
|
||||
[node name="EcoProjectile" type="KinematicBody2D"]
|
||||
collision_layer = 8
|
||||
<<<<<<< HEAD
|
||||
collision_mask = 2
|
||||
=======
|
||||
collision_mask = 6
|
||||
>>>>>>> master
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
|
|
@ -8,11 +8,7 @@ radius = 5.0
|
|||
height = 2.0
|
||||
|
||||
[node name="PhantomProjectile" type="KinematicBody2D"]
|
||||
<<<<<<< HEAD
|
||||
collision_layer = 8
|
||||
=======
|
||||
collision_layer = 2147483656
|
||||
>>>>>>> master
|
||||
collision_mask = 6
|
||||
script = ExtResource( 2 )
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ class_name Projectile
|
|||
|
||||
export var speed = 300
|
||||
var velocity = Vector2.ZERO
|
||||
var energy_cost = 1
|
||||
onready var Hit = get_node("Node/Hit")
|
||||
onready var Hit_Wall = get_node("Node/Hit Wall")
|
||||
|
||||
|
@ -13,6 +14,7 @@ func _physics_process(delta):
|
|||
|
||||
func launch(wand, effect):
|
||||
velocity = (Vector2(speed, 0)).rotated(rotation)
|
||||
return energy_cost
|
||||
|
||||
func on_impact(collision):
|
||||
queue_free()
|
||||
|
|
|
@ -6,5 +6,6 @@ func fire(projectile, effect):
|
|||
var temp = projectile.instance()
|
||||
get_tree().current_scene.add_child(temp)
|
||||
temp.global_transform = $ProjectileSpawn.global_transform
|
||||
temp.launch(null, null)
|
||||
var energy_cost = temp.launch(null, null)
|
||||
$ShootDelay.start()
|
||||
return energy_cost
|
||||
|
|
|
@ -45,7 +45,7 @@ _global_script_class_icons={
|
|||
[application]
|
||||
|
||||
config/name="Gamejam"
|
||||
run/main_scene="res://Title/Tilte.tscn"
|
||||
run/main_scene="res://levels/test.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
@ -55,6 +55,10 @@ IconLoaderGithub="*res://addons/github-integration/scripts/IconLoaderGithub.gd"
|
|||
RestHandler="*res://addons/github-integration/scripts/RestHandler.gd"
|
||||
Globals="*res://script/globals.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
settings/fps/force_fps=60
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=320
|
||||
|
@ -90,47 +94,32 @@ texture={
|
|||
"stream": false,
|
||||
"svg/scale": 1.0
|
||||
}
|
||||
wav={
|
||||
"compress/mode": 0,
|
||||
"edit/loop": true,
|
||||
"edit/normalize": false,
|
||||
"edit/trim": false,
|
||||
"force/8_bit": false,
|
||||
"force/max_rate": false,
|
||||
"force/max_rate_hz": 44100,
|
||||
"force/mono": false
|
||||
}
|
||||
|
||||
[input]
|
||||
|
||||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
shoot={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
]
|
||||
}
|
||||
inventory={
|
||||
|
@ -141,11 +130,14 @@ inventory={
|
|||
|
||||
[layer_names]
|
||||
|
||||
2d_render/layer_1="Player"
|
||||
2d_physics/layer_1="Player"
|
||||
2d_render/layer_2="World"
|
||||
2d_physics/layer_2="World"
|
||||
2d_physics/layer_3="Enemy"
|
||||
2d_physics/layer_4="Projectiles"
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/fallback_to_gles2=true
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
extends Position2D
|
||||
|
||||
onready var parent = get_parent()
|
||||
|
||||
func clear_conduit():
|
||||
for c in get_children():
|
||||
c.queue_free()
|
||||
|
@ -9,5 +11,8 @@ func set_current_conduit(conduit):
|
|||
add_child(conduit.instance())
|
||||
|
||||
func _process(delta):
|
||||
if Input.is_action_pressed("shoot") and get_child_count() != 0:
|
||||
get_children()[0].fire(get_parent().Inventory.active_projectile, null)
|
||||
if Input.is_action_pressed("shoot") and get_child_count() != 0 and parent.Stats.energy > 0:
|
||||
var energy_cost = get_children()[0].fire(get_parent().Inventory.active_projectile, null)
|
||||
if energy_cost != null:
|
||||
parent.energy -= energy_cost
|
||||
parent.Stats.interrupt_regen()
|
||||
|
|
BIN
ui/Energy Burnout.png
Normal file
BIN
ui/Energy Burnout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 B |
34
ui/Energy Burnout.png.import
Normal file
34
ui/Energy Burnout.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Energy Burnout.png-25dbbec15c4781d66d514409c50e5504.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ui/Energy Burnout.png"
|
||||
dest_files=[ "res://.import/Energy Burnout.png-25dbbec15c4781d66d514409c50e5504.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
|
@ -3,15 +3,21 @@ extends CanvasLayer
|
|||
onready var Hearts: TextureProgress = $"Player UI Frame 2/Hearts"
|
||||
onready var Energybar: TextureProgress = $"Player UI Frame 2/Energy"
|
||||
onready var Regen: Timer = $Regen
|
||||
onready var BurnoutSprite: Sprite = $"Player UI Frame 2/Energy Burnout"
|
||||
|
||||
var health = 3 setget set_health, get_health
|
||||
var energy = 5 setget set_energy, get_energy
|
||||
var is_burnout = false
|
||||
|
||||
func _on_Regen_timeout():
|
||||
set_energy(get_energy() + 1)
|
||||
set_energy(get_accurate_energy() + 1)
|
||||
if get_accurate_energy() == Energybar.max_value:
|
||||
is_burnout = false
|
||||
|
||||
func _process(delta):
|
||||
if get_energy() < Energybar.max_value and Regen.is_stopped():
|
||||
BurnoutSprite.visible = is_burnout
|
||||
print(Regen.is_stopped())
|
||||
if get_accurate_energy() < Energybar.max_value and Regen.is_stopped():
|
||||
Regen.start()
|
||||
|
||||
func set_health(value):
|
||||
|
@ -22,8 +28,15 @@ func get_health():
|
|||
|
||||
func set_energy(value):
|
||||
Energybar.value = clamp(value, Energybar.min_value, Energybar.max_value)
|
||||
if Energybar.value == 0:
|
||||
is_burnout = true
|
||||
|
||||
func get_energy():
|
||||
if is_burnout == true:
|
||||
return 0
|
||||
return Energybar.value
|
||||
|
||||
func get_accurate_energy():
|
||||
return Energybar.value
|
||||
|
||||
func interrupt_regen():
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://ui/PlayerStats.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/Player UI Frame 2.png" type="Texture" id=2]
|
||||
[ext_resource path="res://ui/Hearts.png" type="Texture" id=3]
|
||||
[ext_resource path="res://ui/Energy.png" type="Texture" id=4]
|
||||
[ext_resource path="res://ui/Energy Burnout.png" type="Texture" id=5]
|
||||
|
||||
[node name="Stats" type="CanvasLayer"]
|
||||
script = ExtResource( 1 )
|
||||
|
@ -35,14 +36,18 @@ __meta__ = {
|
|||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = -4.99998
|
||||
margin_top = -5.0
|
||||
margin_right = -64.0
|
||||
margin_bottom = -16.0
|
||||
max_value = 5.0
|
||||
step = 1.0
|
||||
value = 5.0
|
||||
texture_progress = ExtResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Energy Burnout" type="Sprite" parent="Player UI Frame 2"]
|
||||
position = Vector2( 23, -1 )
|
||||
texture = ExtResource( 5 )
|
||||
offset = Vector2( 0, 0.5 )
|
||||
[connection signal="timeout" from="Regen" to="." method="_on_Regen_timeout"]
|
||||
|
|
Loading…
Reference in a new issue