initial commit
This commit is contained in:
commit
35bb9bb38f
46 changed files with 1243 additions and 0 deletions
24
Bullet.gd
Normal file
24
Bullet.gd
Normal file
|
@ -0,0 +1,24 @@
|
|||
extends Node2D
|
||||
|
||||
var velocity : Vector2 = Vector2.ZERO
|
||||
var lifetime : float = 3.0
|
||||
const speed = 300
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func init(p_velocity : Vector2):
|
||||
velocity = p_velocity
|
||||
|
||||
func _process(delta):
|
||||
position += velocity * delta * speed
|
||||
lifetime -= delta
|
||||
if lifetime < 0:
|
||||
queue_free()
|
||||
|
||||
func _on_BulletArea_body_entered(body):
|
||||
if body.has_method("is_player"):
|
||||
return
|
||||
if body.has_method("take_damage"):
|
||||
body.take_damage(1)
|
||||
queue_free()
|
Loading…
Add table
Add a link
Reference in a new issue