Projectile Weapon

made a gun that can kill the enemy.

# Conflicts:
#	scenes/enemy.tscn
#	scenes/player.tscn
#	scenes/test_scene.tscn
#	scripts/UltimatePlatformerController.gd
This commit is contained in:
sam committed 2026-10-03 16:08:19 -06:00
1 parent 2ecc24ae71
commit 90111f8b39
14 files changed
+166 -63

No files matched your search

+25 -16
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.
@@ -138,7 +138,7 @@ var gravityActive: bool = true
var dashing: bool = false
var dashCount: int
var rolling: bool = false
var death_counter = 3
var twoWayDashHorizontal
var twoWayDashVertical
var eightWayDash
@@ -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
@@ -254,8 +254,6 @@ func _updateData():
func _process(_delta):
#INFO animations
#directions
if death_counter == 0:
get_tree().quit()
if is_on_wall() and !is_on_floor() and latch and wallLatching and ((wallLatchingModifer and latchHold) or !wallLatchingModifer):
latched = true
else:
@@ -322,15 +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 death_counter == 2:
$health/ColorRect3.hide()
elif death_counter == 1:
$health/ColorRect2.hide()
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
@@ -682,5 +691,5 @@ func _placeHolder():
print("")
func _on_area_2d_body_entered(body: Node2D) -> void:
death_counter -= 1
func shoot():
pass
+11
View File
@@ -0,0 +1,11 @@
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
+1
View File
@@ -0,0 +1 @@
uid://v7bcqfwryutg