CrawlingEnemy, PlantEnemy
This commit is contained in:
parent
930ff3e2bb
commit
f6758e1dba
6 changed files with 233 additions and 4 deletions
15
metroidvania/Scenes/Enemies/PlantEnemy.gd
Normal file
15
metroidvania/Scenes/Enemies/PlantEnemy.gd
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue