Compare commits

...

3 Commits

Author SHA1 Message Date
8b8349d5ab removed the tween from the angle changing 2025-03-10 19:44:39 -05:00
976d690299 need to fix the angle interpolation but its a start (#8)
it does a weird thing when you go from one side to the other, probably because of how godot handles the angles. It's def fixable but I'll have to play around with it more

Reviewed-on: #8
Reviewed-by: ysandler <accounts@tzed.io>
Co-authored-by: Travis Gatlin <travisgatlin53@yahoo.com>
Co-committed-by: Travis Gatlin <travisgatlin53@yahoo.com>
2025-03-10 19:23:22 -05:00
66f09fb6eb Merge pull request 'hihihihihihihihihihihihi' (#7) from add-basic-movement into main
Reviewed-on: #7
Reviewed-by: ysandler <accounts@tzed.io>
2025-02-16 15:42:01 -06:00
3 changed files with 105 additions and 8 deletions

93
dem8633.tmp Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,7 @@ extends CharacterBody2D
@onready var global = $"/root/Player"
const SPEED = 350.0
var charAngle = 0.0
func _physics_process(delta: float) -> void:
global.emit_signal("playerPosition",self.global_position)
movement()
@ -14,6 +13,10 @@ func animation():
func movement():
var vertical = Input.get_axis("up","down")
var horizontal = Input.get_axis("left","right")
var rotVector = Vector2(vertical*-1,horizontal)
if rotVector != Vector2(0,0):
self.set_rotation(rotVector.angle())
#limiting diagonal speed
if is_equal_approx(abs(vertical),1.0) and is_equal_approx(abs(horizontal),1.0):
velocity.y = SPEED*vertical/2
velocity.x = SPEED*horizontal/2
@ -21,4 +24,4 @@ func movement():
velocity.y = SPEED * vertical
velocity.x = SPEED * horizontal
move_and_slide()
$"../Camera2D/Label".text = (str(self.global_position))
$"../Camera2D/Label".text = (str(charAngle*180/PI))