Player gun, bullet and its collisiions. Refactor.
This commit is contained in:
parent
0dd3f24030
commit
ffb7c8bf99
28 changed files with 562 additions and 131 deletions
20
metroidvania/Scenes/Objects/Proyectile.gd
Normal file
20
metroidvania/Scenes/Objects/Proyectile.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends Node2D
|
||||
|
||||
var velocity = Vector2.ZERO
|
||||
|
||||
func _process(delta):
|
||||
position += velocity * delta
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_viewport_exited(_viewport):
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_Hitbox_body_entered(_body):
|
||||
# When we collide with the world
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_Hitbox_area_entered(_area):
|
||||
# When we collide with an enemy (a hurtbox)
|
||||
queue_free()
|
Loading…
Add table
Add a link
Reference in a new issue