Skip to content

Commit

Permalink
Add Fast Laser Effect
Browse files Browse the repository at this point in the history
Adds a new effect that hooks in to the physics system to make lasers
go pewpew faser
  • Loading branch information
Checkroth committed Aug 19, 2024
1 parent dbb2976 commit 45bc4c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions projectiles/fast_laser.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://dj6jn0ia62yba"]

[ext_resource type="Script" path="res://projectiles/projectile_effect.gd" id="1_jlt11"]

[node name="FastLaser" type="Node"]
script = ExtResource("1_jlt11")
speed_modifier = 3
5 changes: 2 additions & 3 deletions units/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ const HORIZONTAL_BUFFER = 75

@export var Projectile : PackedScene
@onready var projectile_spawner = $ProjectileSpawner
var FastLaserEffect : PackedScene = preload("res://projectiles/fast_laser.tscn")
var DoubleLaserEffect : PackedScene = preload("res://projectiles/double_laser.tscn")
var HugeLaserEffect : PackedScene = preload("res://projectiles/huge_laser.tscn")
var FastLaserEffect : PackedScene = preload("res://projectiles/fast_laser.tscn")

# Called when the node enters the scene tree for the first time.
func _ready():
Projectile = load("res://units/projectile.tscn")
_add_test_effects()

func fire():
print('fired!')
var p = Projectile.instantiate()
# Effects must be instantiated for each projectile.
# Finding a way to manage "which effects we need to instantiate" and
# "Which effects are actually on this projectile" is key
var effects = [DoubleLaserEffect, HugeLaserEffect]
var effects = [DoubleLaserEffect, HugeLaserEffect, FastLaserEffect]
p.spawn(owner, effects, transform)

# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down

0 comments on commit 45bc4c8

Please sign in to comment.