Added shooter ship
This commit is contained in:
parent
154da5104e
commit
ab3ac4af66
10 changed files with 232 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ func process(_delta):
|
|||
# checking if need to apply torque
|
||||
destination_degrees = rad_to_deg(ship.global_position.angle_to_point(target.global_position))
|
||||
current_destination_difference = destination_degrees - ship.hull.global_rotation_degrees
|
||||
|
||||
if abs(current_destination_difference) > destination_difference:
|
||||
ship.engine.rotation_axis = clamp(current_destination_difference / 360 + 0.5 * sign(current_destination_difference), -1.0, 1.0)
|
||||
else:
|
||||
|
|
@ -44,6 +45,7 @@ func process(_delta):
|
|||
ship.hull.apply_central_force(Vector2.from_angle(ship.hull.rotation) * additional_stab_force)
|
||||
# making ship always accelerate
|
||||
ship.engine.acceleration_axis = 1.0
|
||||
|
||||
var distance_to_target = ship.global_position.distance_to(target.global_position)
|
||||
if distance_to_target > target_loss_distance:
|
||||
get_parent().transit("WanderingState")
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ func enter(_message):
|
|||
func process(_delta):
|
||||
# checking if need to apply torque
|
||||
current_destination_difference = destination_degrees - ship.hull.global_rotation_degrees
|
||||
|
||||
if abs(current_destination_difference) > destination_difference:
|
||||
ship.engine.rotation_axis = clamp(current_destination_difference / 360 + 0.5 * sign(current_destination_difference), -1.0, 1.0)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue