mirror of
https://github.com/Steffo99/cinnos.git
synced 2024-11-22 08:04:20 +00:00
asdiogrdiogeriog
This commit is contained in:
parent
3250c017ff
commit
ab27c3f440
4 changed files with 16 additions and 16 deletions
12
Torretta.gd
12
Torretta.gd
|
@ -5,6 +5,7 @@ extends StaticBody3D
|
|||
|
||||
@export var max_distance: float = 30.0
|
||||
@export var rotation_speed = 0.1
|
||||
@export var initial_cooldown: float = 0.1
|
||||
|
||||
var bullet = preload("res://obstacles/bullet.tscn")
|
||||
var cooldown = 0
|
||||
|
@ -26,10 +27,17 @@ func _physics_process(delta):
|
|||
else:
|
||||
var bull = bullet.instantiate()
|
||||
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)
|
||||
cooldown = 5
|
||||
cooldown = initial_cooldown
|
||||
|
||||
|
||||
|
||||
|
|
11
bullet.gd
11
bullet.gd
|
@ -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
|
|
@ -13,6 +13,5 @@ func _process(delta):
|
|||
|
||||
func _on_body_entered(body):
|
||||
if body is Player:
|
||||
body.velocity += (global_position - body.global_position).normalized() * 5
|
||||
print("AAAAAA")
|
||||
body.velocity += (body.global_position - global_position).normalized() * 8
|
||||
queue_free()
|
||||
|
|
|
@ -9,8 +9,12 @@ radius = 0.58729
|
|||
|
||||
[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)
|
||||
collision_layer = 4
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
script = ExtResource("1_dawle")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
|
|
Loading…
Reference in a new issue