systeme pour avoir plusieurs armes et un shotgun thingy
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
extends Area2D
|
||||
|
||||
@export var DAMAGE = 1;
|
||||
@export var SPEED = 800;
|
||||
@export var LIFETIME = 3;
|
||||
@export var DAMAGE = 10;
|
||||
@export var SPEED = 700;
|
||||
@export var LIFETIME = 1;
|
||||
|
||||
@onready var life_timer = $LifeTimer;
|
||||
|
||||
@@ -12,14 +12,19 @@ func _process(delta):
|
||||
if velocity != Vector2.ZERO:
|
||||
transform.origin += velocity * delta;
|
||||
|
||||
func launch(direction):
|
||||
func launch(direction, based_velocity):
|
||||
life_timer.start(LIFETIME);
|
||||
velocity = direction * SPEED;
|
||||
velocity = based_velocity + direction * SPEED;
|
||||
|
||||
func _on_life_timer_timeout():
|
||||
queue_free();
|
||||
|
||||
|
||||
func _on_body_entered(body):
|
||||
if body.is_in_group("enemies"):
|
||||
body.take_damage(DAMAGE);
|
||||
if body.name != "Player":
|
||||
if body.is_in_group("enemies"):
|
||||
body.take_damage(DAMAGE);
|
||||
explode();
|
||||
|
||||
func explode():
|
||||
#animation and stuff
|
||||
queue_free();
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
[ext_resource type="Texture2D" uid="uid://gqotbni355f" path="res://Sprites/placeholder_projectile.png" id="1_o7jy1"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pp7ve"]
|
||||
size = Vector2(10, 10)
|
||||
|
||||
[node name="basic_projectile" type="Area2D"]
|
||||
script = ExtResource("1_l2kyf")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(5, 5)
|
||||
scale = Vector2(10, 10)
|
||||
texture = ExtResource("1_o7jy1")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user