Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- # member variables here, example:
- # var a=2
- # var b="textvar"
- func _ready():
- set_fixed_process(true)
- # Initialization here
- pass
- func _fixed_process(delta):
- var min_degrees = -1.5
- var max_degrees = 1.5
- var speed = 150
- #var dir = Vector2(0,0)
- var rot = get_node("player").get_rot()
- if Input.is_action_pressed("ui_left"):
- rot -= deg2rad( 120 * delta )
- if Input.is_action_pressed("ui_right"):
- rot += deg2rad( 120 * delta )# rotate 120 degrees / second
- if rot < min_degrees:
- rot = min_degrees
- if rot > max_degrees:
- rot = max_degrees
- get_node("player").set_rot(rot)
- print(rad2deg(rot))
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement