A Third-Person-Shooter Godot game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
646 B

extends Spatial
func shoot(player, shoot_origin, shoot_dir, col):
# Shoot a projectile
var bullet = preload("res://player/bullet/bullet.tscn").instance()
player.get_parent().add_child(bullet) # Not a child of our player
bullet.global_transform.origin = shoot_origin
# If we don't rotate the bullets there is no useful way to control the particles ..
bullet.look_at(shoot_origin + shoot_dir, Vector3.UP)
bullet.add_collision_exception_with(player)
var shoot_particle = $ShootParticle
shoot_particle.restart()
shoot_particle.emitting = true
var muzzle_particle = $MuzzleFlash
muzzle_particle.restart()
muzzle_particle.emitting = true