mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-22 04:34:19 +00:00
✨ Create ChangeFireIntensity
pickup
This commit is contained in:
parent
2b59dceada
commit
e87b6e21d2
2 changed files with 29 additions and 0 deletions
23
src/entities/pickupeffects/ChangeFireIntensity.gd
Normal file
23
src/entities/pickupeffects/ChangeFireIntensity.gd
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
export var target_path: NodePath = NodePath("../../Fire")
|
||||||
|
export var amount_per_second: float = 0.2
|
||||||
|
onready var target = get_node(target_path)
|
||||||
|
onready var pickup: Area2D = get_parent()
|
||||||
|
|
||||||
|
var active = false
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# warning-ignore: RETURN_VALUE_DISCARDED
|
||||||
|
pickup.connect("picked_up", self, "_on_picked_up")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_picked_up():
|
||||||
|
active = true
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if active:
|
||||||
|
target.intensity += delta * amount_per_second
|
6
src/entities/pickupeffects/ChangeFireIntensity.tscn
Normal file
6
src/entities/pickupeffects/ChangeFireIntensity.tscn
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/entities/pickupeffects/ChangeFireIntensity.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="ChangeFireIntensity" type="Node"]
|
||||||
|
script = ExtResource( 1 )
|
Loading…
Reference in a new issue