Skip to content

Commit

Permalink
Use const for preload
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumlamm committed Apr 15, 2024
1 parent ad4ffb9 commit 82f2f89
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/scripts/enemies/bookworm.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ var attack_target := Vector2(0, 0)
@onready var shape: CollisionShape2D = $PhysicsCollider
@onready var anim: AnimationPlayer = $AnimationPlayer
@onready var map: TileMap = get_parent().find_child('Map')
@onready var Spear = preload("res://scenes/projectiles/spearlike.tscn")

const Spear = preload("res://scenes/projectiles/spearlike.tscn")

func _ready() -> void:
super._ready()
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/pentagram.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const CLIP_ANGLE := 0.5
@onready var image: TextureRect = $Pentagram
@onready var multiline: Line2D = $Multiline

@onready var clip_effect = preload("res://scenes/clip_particles_effect.tscn")
const clip_effect = preload("res://scenes/clip_particles_effect.tscn")

const PENTAGRAM_CORNERS: Array[Vector2] = [
Vector2(0.5, 0.885),
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/sfx_audio.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum Sound {
PUSH_BACK
}

var SoundDict = {
const SoundDict = {
Sound.CHEST: preload("res://assets/sfx/chest.mp3"),
Sound.DRAW: preload("res://assets/sfx/draw.mp3"),
Sound.DRAW_INVALID: preload("res://assets/sfx/draw_invalid_spell.mp3"),
Expand Down
5 changes: 2 additions & 3 deletions src/scripts/spells/push_back.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
extends SpellBase

var Pushback_Projectile = preload("res://scenes/projectiles/pushback.tscn")
const PushbackProjectile = preload("res://scenes/projectiles/pushback.tscn")

func cast(player: Player, _enemies: Array[Node]):
SfxAudio.play_sfx(SfxAudio.Sound.PUSH_BACK)
var projectile = Pushback_Projectile.instantiate()
spawn_projectile(player, projectile)
spawn_projectile(player, PushbackProjectile.instantiate())

0 comments on commit 82f2f89

Please sign in to comment.