Quick update: I added a BOOM!
What would a pilot of an Uncontrollable Spaceship do if they got stuck? Throw a hand-grenade out the window and see what happens!
The BOOM! button throws out a hand-grenade that explodes with random force in a random direction. If it bounces your ship so that you’re pointing in a useful direction, START THRUSTING!
func _physics_process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
boomtimer = boomtimer +1
if Input.is_key_pressed(KEY_Z):
var rotation = self.get_global_rotation()
var forwardNormal = Vector2(0,1).rotated(rotation)
self.apply_impulse(Vector2(),forwardNormal * -thrust_amount * delta)
# print ("thrust")
if Input.is_key_pressed(KEY_A) and (boomtimer>15):
self.apply_impulse(Vector2(randf()*200,randf()*200),Vector2(randf()*20,randf()*20))
boomtimer = 0
pass
ew… that line with the self.apply_impulse is so long with no spaces that it wrapped funny. No time to worry about that. I’ll clean up code when I’m dead!