CrawlingEnemy, PlantEnemy

This commit is contained in:
Felipe M 2021-05-18 14:16:01 +02:00
parent 930ff3e2bb
commit f6758e1dba
Signed by: fmartingr
GPG key ID: 716BC147715E716F
6 changed files with 233 additions and 4 deletions

View file

@ -0,0 +1,15 @@
extends "res://Scenes/Enemies/Enemy.gd"
const EnemyBullet = preload("res://Scenes/Objects/EnemyBullet.tscn")
export (int) var BULLET_SPEED = 30
export (float) var SPREAD = 30
onready var fireDirection = $FireDirection
onready var bulletSpawnPoint = $BulletSpawnPoint
func fire_bullet():
var bullet = Utils.instance_scene_on_main(EnemyBullet, bulletSpawnPoint.global_position)
var velocity = (fireDirection.global_position - global_position).normalized() * BULLET_SPEED
velocity = velocity.rotated(deg2rad(rand_range(-SPREAD, SPREAD)))
bullet.velocity = velocity