Projectile Weapon

made a gun that can kill the enemy.
This commit is contained in:
sam committed 2026-10-03 15:58:09 -06:00
1 parent 2315add8ec
commit 8bfa979f06
14 files changed
+202 -13

No files matched your search

+26 -7
View File
@@ -25,7 +25,7 @@ class_name PlatformerController2D
@export var directionalSnap: bool = false
##If enabled, the default movement speed will by 1/2 of the maxSpeed and the player must hold a "run" button to accelerate to max speed. Assign "run" (case sensitive) in the project input settings.
@export var runningModifier: bool = false
var direction = 0
#INFO JUMPING
@export_category("Jumping and Gravity")
##The peak height of your player's jump
@@ -115,7 +115,7 @@ class_name PlatformerController2D
@export var crouch_walk: bool
##Animations must be named "roll" all lowercase as the check box says
@export var roll: bool
var projectile = preload("res://scenes/projectile.tscn")
#Variables determined by the developer set ones.
@@ -158,7 +158,7 @@ var latched
var wasLatched
var crouching
var groundPounding
var death_counter = 3
var anim = PlayerSprite
var col
var animScaleLock : Vector2
@@ -180,7 +180,7 @@ var dashTap
var rollTap
var downTap
var twirlTap
var enemy = preload("res://scenes/enemy.tscn")
func _ready():
wasMovingR = true
anim = PlayerSprite
@@ -320,11 +320,26 @@ func _process(_delta):
if rollTap and canRoll and roll:
anim.speed_scale = 1
anim.play("roll")
var dir: bool = 1
func _physics_process(delta):
if Input.is_action_pressed("right"):
dir = 1
if Input.is_action_pressed("left"):
dir = 0
if Input.is_action_just_pressed("fire"):
var instance = projectile.instantiate()
if !dir:
instance.speed = -instance.speed
instance.position = $Marker2D.global_position
GloblaData.test_level.add_child(instance)
if GloblaData.death_counter == 0:
get_tree().quit()
if GloblaData.death_counter == 2:
$ColorRect3.hide()
elif GloblaData.death_counter == 1:
$ColorRect4.hide()
if !dset:
gdelta = delta
dset = true
@@ -674,3 +689,7 @@ func _endGroundPound():
func _placeHolder():
print("")
func shoot():
pass