1
Fork 0
mirror of https://github.com/Steffo99/cinnos.git synced 2024-11-22 08:04:20 +00:00

asdiogrdiogeriog

This commit is contained in:
Steffo 2023-11-25 18:49:48 +01:00
parent 3250c017ff
commit ab27c3f440
4 changed files with 16 additions and 16 deletions

View file

@ -5,6 +5,7 @@ extends StaticBody3D
@export var max_distance: float = 30.0 @export var max_distance: float = 30.0
@export var rotation_speed = 0.1 @export var rotation_speed = 0.1
@export var initial_cooldown: float = 0.1
var bullet = preload("res://obstacles/bullet.tscn") var bullet = preload("res://obstacles/bullet.tscn")
var cooldown = 0 var cooldown = 0
@ -26,10 +27,17 @@ func _physics_process(delta):
else: else:
var bull = bullet.instantiate() var bull = bullet.instantiate()
bull.global_position = global_position bull.global_position = global_position
bull.set_linear_velocity((player.global_position - global_position).normalized() * 50)
var diff_x = player.global_position.x - global_position.x
var diff_z = player.global_position.z - global_position.z
var diff = Vector3(diff_x, 0, diff_z)
var norm = diff.normalized()
bull.set_linear_velocity(norm * 50)
get_tree().root.add_child(bull) get_tree().root.add_child(bull)
cooldown = 5 cooldown = initial_cooldown

View file

@ -1,11 +0,0 @@
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View file

@ -13,6 +13,5 @@ func _process(delta):
func _on_body_entered(body): func _on_body_entered(body):
if body is Player: if body is Player:
body.velocity += (global_position - body.global_position).normalized() * 5 body.velocity += (body.global_position - global_position).normalized() * 8
print("AAAAAA")
queue_free() queue_free()

View file

@ -9,8 +9,12 @@ radius = 0.58729
[node name="Bullet" type="RigidBody3D"] [node name="Bullet" type="RigidBody3D"]
transform = Transform3D(-4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, 0, 0, 0) transform = Transform3D(-4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, 0, 0, 0)
collision_layer = 4 collision_layer = 0
collision_mask = 4 collision_mask = 4
gravity_scale = 0.0
continuous_cd = true
max_contacts_reported = 1
contact_monitor = true
script = ExtResource("1_dawle") script = ExtResource("1_dawle")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]