-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extends Node | ||
|
||
func instance(scene:PackedScene, parent_reference:ReferenceNodeResource, position:Vector2 = Vector2.ZERO)->void: | ||
assert(scene != null) | ||
assert(parent_reference != null) | ||
assert(parent_reference.node != null) | ||
var inst:Node = scene.instantiate() | ||
if inst is CanvasItem || inst is Node3D: | ||
inst.global_position = position | ||
parent_reference.node.add_child(inst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class_name HitLimit | ||
extends Node | ||
|
||
@export var projectile:Projectile2D | ||
@export var damage_source:DamageSource | ||
## Projectile is removed when reaching 0 | ||
## Starting with negative has infinite count | ||
@export var hit_limit:int = 1 | ||
|
||
func _ready()->void: | ||
damage_source.hit.connect(on_hit) | ||
damage_source.hit_solid.connect(projectile.prepare_exit) | ||
|
||
func on_hit()->void: | ||
if hit_limit < 1: | ||
return | ||
hit_limit -= 1 | ||
if hit_limit != 0: | ||
return | ||
|
||
projectile.prepare_exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class_name ProjectileLifetime | ||
extends Node | ||
|
||
@export var time:float = 1.0 | ||
@export var projectile:Projectile2D | ||
|
||
func _ready()->void: | ||
if !(time > 0.0): | ||
return | ||
var tween:Tween = create_tween() | ||
tween.tween_callback(on_timeout).set_delay(time) | ||
|
||
func on_timeout()->void: | ||
projectile.prepare_exit() |