123456789101112131415161718192021222324252627282930313233 |
- extends Node2D
- onready var MAIN = find_parent("MAIN")
- # Declare member variables here. Examples:
- # var a: int = 2
- # var b: String = "text"
- var pulsating = true
- var phase = 0
- var hertz = 1
- func _process(delta: float) -> void:
- if MAIN.started:
- position.x += MAIN.speed * delta
- if pulsating:
- phase += delta*hertz*2*PI
- scale.x = 1 + pow(sin(phase),2)*0.2
- scale.y = 1 - pow(sin(phase+0.1),2)*0.1
- if position.x <= -200:
- queue_free()
- # Called when the node enters the scene tree for the first time.
- func _ready() -> void:
- $scaler/area.connect("body_entered",self,"on_hit")
- pass # Replace with function body.
- func on_hit(_body):
- MAIN.delegation_hit = true
- print("hit spaceship")
- $scaler/alive.visible = false
- $scaler/dead.visible = true
- pulsating = false
|