Rename Player.gd to player.gd
i cant believe its not butter
This commit is contained in:
parent
1be256e74c
commit
2f1539a136
1 changed files with 0 additions and 0 deletions
43
player.gd
Normal file
43
player.gd
Normal file
|
@ -0,0 +1,43 @@
|
|||
extends RigidBody2D
|
||||
|
||||
var speed = 1000 # move speed in pixels/sec
|
||||
var rotation_speed = 3 # turning speed in radians/sec
|
||||
var quare = preload("res://quare.tscn")
|
||||
var exagon = preload("res://exagon.tscn")
|
||||
@onready var notifier = $"../Notification"
|
||||
var absolute_movement = false
|
||||
var config = ConfigFile.new()
|
||||
|
||||
var moving = false
|
||||
var frozen = false
|
||||
|
||||
func update_animation():
|
||||
pass
|
||||
|
||||
func _ready():
|
||||
update_animation()
|
||||
if config.load("user://settings.cfg") == OK:
|
||||
absolute_movement = not config.get_value("config", "relative_controls")
|
||||
|
||||
func _physics_process(delta):
|
||||
if frozen:
|
||||
return
|
||||
look_at(get_global_mouse_position())
|
||||
var move_input = Input.get_axis("down", "up")
|
||||
var side_input = Input.get_axis("right", "left")
|
||||
if move_input > 0 and not moving:
|
||||
moving = true
|
||||
update_animation()
|
||||
elif move_input <= 0 and moving:
|
||||
moving = false
|
||||
update_animation()
|
||||
|
||||
if absolute_movement:
|
||||
apply_central_force(Vector2(side_input, move_input).normalized() * -speed)
|
||||
else:
|
||||
apply_central_force(transform.y * side_input * speed / -2 + transform.x * move_input * speed)
|
||||
|
||||
func destroy():
|
||||
$DeathFX.play()
|
||||
get_tree().paused = true
|
||||
$"../GameOver".visible = true
|
Loading…
Add table
Add a link
Reference in a new issue