You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
I want to make it so there are upgrades that increases how many lasers the players fire at once.
So 2 lasers would fire a little bit to the left of the enemy targets direction and a little bit to the right. And so on. See picture above for what I mean.
Currently this is the laser code.
Notice how the target is set so the laser can calculate its direction. Well this is sort of a problem because how are we going to define lasers at varying angles.
// Projectile.cspublicpartialclassProjectile:Node2D{publicVector2Target{get;set;}GTimertimerDestroy;Vector2dir;publicoverridevoid_Ready(){timerDestroy=new(this,5000);timerDestroy.Finished+=QueueFree;timerDestroy.Start();dir=(Target-Position).Normalized();Rotation=dir.Angle()+Mathf.Pi/2;GetNode<Area2D>("Area2D").BodyEntered+= body =>{if(bodyisBlobenemy){Level.Enemies.Remove(enemy.GetInstanceId());enemy.Kill();}};}publicoverridevoid_PhysicsProcess(doubledelta){varspeed=10;Position+=dir*speed;}}
The player currently shoots a laser every second.
I want to make it so there are upgrades that increases how many lasers the players fire at once.
So 2 lasers would fire a little bit to the left of the enemy targets direction and a little bit to the right. And so on. See picture above for what I mean.
Currently this is the laser code.
Notice how the target is set so the laser can calculate its direction. Well this is sort of a problem because how are we going to define lasers at varying angles.