hand to hand weapon

made a close range weapon that can kill the enemy.
This commit is contained in:
sam committed 2026-10-03 19:51:33 -06:00
1 parent 7b15d90633
commit 569e225436
6 files changed
+106 -15

No files matched your search

+25 -5
View File
@@ -46,7 +46,7 @@ var direction = 0
@export_range(0, 0.5) var coyoteTime: float = 0.2
##The window of time (in seconds) that your player can press the jump button before hitting the ground and still have their input registered as a jump. This is set to 0.2 seconds by default.
@export_range(0, 0.5) var jumpBuffering: float = 0.2
var slash = 300
#INFO EXTRAS
@export_category("Wall Jumping")
##Allows your player to jump off of walls. Without a Wall Kick Angle, the player will be able to scale the wall.
@@ -162,7 +162,7 @@ var death_counter = 3
var anim = PlayerSprite
var col
var animScaleLock : Vector2
var weapon = 1
#Input Variables for the whole script
var upHold
var downHold
@@ -324,20 +324,36 @@ func _process(_delta):
var dir: bool = 1
func _physics_process(delta):
if Input.is_action_just_pressed("slash_weapon"):
weapon = 1
GloblaData.weapon = 1
if Input.is_action_just_pressed("gun"):
weapon = 2
GloblaData.weapon = 2
if GloblaData.doing_puzzle == true:
$".".global_position = $"../Marker2D2".global_position
$Label.text = str(int(GloblaData.cassets))
if Input.is_action_pressed("right"):
if Input.is_action_just_pressed("right"):
dir = 1
if Input.is_action_pressed("left"):
$ColorRect5.global_position = $Marker2D3.global_position
$ColorRect5.rotation = 130
if Input.is_action_just_pressed("left"):
$ColorRect5.global_position = $Marker2D2.global_position
$ColorRect5.rotation = -130
dir = 0
if GloblaData.doing_puzzle == false:
if Input.is_action_just_pressed("fire"):
if Input.is_action_just_pressed("fire") and weapon == 2:
var instance = projectile.instantiate()
if !dir:
instance.speed = -instance.speed
instance.position = $Marker2D.global_position
GloblaData.level_1.add_child(instance)
elif Input.is_action_just_pressed("fire") and weapon == 1:
$ColorRect5.rotation -= slash
slash = -slash
GloblaData.hurtable = true
$Timer.start()
if GloblaData.death_counter == 0:
get_tree().quit()
if GloblaData.death_counter == 2:
@@ -698,3 +714,7 @@ func _placeHolder():
func shoot():
pass
func _on_timer_timeout() -> void:
GloblaData.hurtable = false