added tin
This commit is contained in:
parent
f11679100c
commit
65a4fd8742
9 changed files with 189 additions and 1 deletions
29
objects/enemy/enemy_move_diagonal.gd
Normal file
29
objects/enemy/enemy_move_diagonal.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends "res://objects/enemy/enemy.gd"
|
||||
|
||||
#How far to move
|
||||
export var up_boundary = 0.0
|
||||
export var down_boundary = 0.0
|
||||
#Start direction
|
||||
var direction = Vector2(1,1)
|
||||
export var speed = 50
|
||||
#Move horizontal or vertical
|
||||
export(int, "Left To Right", "Right To Left") var move_direction
|
||||
#Onreadys
|
||||
onready var startpos = position
|
||||
|
||||
func _ready():
|
||||
death_sound = Game.a_die_robot
|
||||
up_boundary *= 8
|
||||
down_boundary *= 8
|
||||
#Move in direction selected
|
||||
if move_direction == 0:
|
||||
direction = Vector2(-1,-1)
|
||||
|
||||
func _physics_process(delta):
|
||||
#Move
|
||||
position += direction * (speed * delta)
|
||||
#Switch dir
|
||||
if position.y >= startpos.y + (down_boundary):
|
||||
direction *= -1
|
||||
if position.y <= startpos.y - (up_boundary):
|
||||
direction *= -1
|
Loading…
Add table
Add a link
Reference in a new issue