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:
1 parent
2ecc24ae71
commit
90111f8b39
14 files changed
+166
-63
No files matched your search
@@ -0,0 +1,37 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
|
||||
var SPEED = Vector2(5, 0)
|
||||
const JUMP_VELOCITY = -400.0
|
||||
@onready var projectile: PackedScene = preload("res://scenes/projectile.tscn")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
patrol()
|
||||
|
||||
|
||||
func patrol():
|
||||
position += SPEED
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
SPEED = -SPEED
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _on_area_2d_area_entered(area: Area2D) -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
GloblaData.death_counter -= 1
|
||||
Reference in new issue
Block a user