made the game real
This commit is contained in:
parent
dccc27dd72
commit
e2ddd9cefe
15 changed files with 211 additions and 10 deletions
22
objects/player/bullet_emitter/player_bullet_emitter.gd
Normal file
22
objects/player/bullet_emitter/player_bullet_emitter.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
extends Node2D
|
||||
|
||||
@export var Bullet: PackedScene
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("shoot"):
|
||||
$Timer.start()
|
||||
_on_timer_timeout()
|
||||
elif event.is_action_released("shoot"):
|
||||
$Timer.stop()
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
print("yeth")
|
||||
var bullet = Bullet.instantiate()
|
||||
get_owner().get_owner().add_child(bullet)
|
||||
bullet.global_position = $Marker2D.global_position
|
||||
|
||||
var bullet2 = Bullet.instantiate()
|
||||
get_owner().get_owner().add_child(bullet2)
|
||||
bullet2.global_position = $Marker2D2.global_position
|
||||
Loading…
Add table
Add a link
Reference in a new issue