bullet collision seems fixed
This commit is contained in:
@@ -9,20 +9,19 @@ var ammo_current = [0,0]
|
||||
var ammo_reserve = [0,0]
|
||||
var guns_dict = {}
|
||||
var current_gun_index
|
||||
|
||||
var money = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
#Set up starting guns and ammo
|
||||
held_guns = [gun_1,gun_2]
|
||||
var instance_gun = held_guns[0].instantiate()
|
||||
var instance_gun_2 = held_guns[1].instantiate()
|
||||
|
||||
#set up ammo for starting guns
|
||||
ammo_current[1] = instance_gun_2.max_ammo
|
||||
ammo_reserve[1] = instance_gun_2.max_ammo * instance_gun_2.start_mags
|
||||
ammo_current[0] = instance_gun.max_ammo
|
||||
ammo_reserve[0] = instance_gun.max_ammo * instance_gun.start_mags
|
||||
#spawn first gun
|
||||
# Spawn first gun
|
||||
current_gun_index = 0
|
||||
gun_spawn(0)
|
||||
|
||||
@@ -7,6 +7,7 @@ extends RigidBody3D
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var rand_amt
|
||||
var player
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@@ -16,3 +17,8 @@ func _ready():
|
||||
collision_shape.disabled = true
|
||||
await get_tree().create_timer(1).timeout
|
||||
self.queue_free()
|
||||
|
||||
func _physics_process(delta):
|
||||
if player != null:
|
||||
var float_direction = player.global_position - self.position
|
||||
self.set_linear_velocity(float_direction * 10)
|
||||
|
||||
@@ -247,10 +247,8 @@ func _on_pick_up_detection_body_entered(body):
|
||||
|
||||
|
||||
func _on_pick_up_magnet_body_entered(body):
|
||||
if body.is_in_group("pickup"):
|
||||
body.collision_shape.disabled = true
|
||||
var pickup_direction = self.global_position - body.global_position
|
||||
body.linear_velocity += pickup_direction * 5
|
||||
if body.is_in_group("pickup") and body.is_in_group("magnet"):
|
||||
body.player = self
|
||||
|
||||
func weapon_tilt(input_x, delta):
|
||||
if weapon_holder:
|
||||
|
||||
Reference in New Issue
Block a user