made a lil asteroids game but now messing around with packed scenes so putting a save heere
This commit is contained in:
parent
caa2cd4c11
commit
d5c27030c5
9 changed files with 129 additions and 16 deletions
13
games/asteroids/ship_controller.gd
Normal file
13
games/asteroids/ship_controller.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
extends RigidBody2D
|
||||
|
||||
@export var rotation_force = 1
|
||||
@export var drag = 2
|
||||
@export var top_speed = 6
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var input = Input.get_axis("asteroids_left","asteroids_right")
|
||||
angular_velocity += rotation_force * delta * input
|
||||
print(angular_velocity)
|
||||
angular_velocity = clampf(angular_velocity, -top_speed, top_speed)
|
||||
if(input == 0):
|
||||
angular_velocity = move_toward(angular_velocity, 0, delta * drag)
|
||||
Loading…
Add table
Add a link
Reference in a new issue