Adjusted velocity calculation without acceleration.
This commit is contained in:
parent
75d963d2a5
commit
e5eea103ab
2 changed files with 12 additions and 11 deletions
|
|
@ -34,18 +34,19 @@ func _process(delta):
|
|||
position = position.clamp(Vector2(12,12), screensize - Vector2(12,12))
|
||||
|
||||
# Update velocity based on input
|
||||
var direction = Vector2.ZERO
|
||||
if Input.is_action_pressed("down"):
|
||||
direction.y += 1
|
||||
if Input.is_action_pressed("up"):
|
||||
direction.y -= 1
|
||||
|
||||
# Normalize direction and apply speed
|
||||
if direction.length() > 0:
|
||||
velocity = direction.normalized() * speed
|
||||
#var direction = Vector2.ZERO
|
||||
#if Input.is_action_pressed("down"):
|
||||
#direction.y += 1
|
||||
#if Input.is_action_pressed("up"):
|
||||
#direction.y -= 1
|
||||
#
|
||||
## Normalize direction and apply speed
|
||||
#if direction.length() > 0:
|
||||
#velocity = direction.normalized() * speed
|
||||
|
||||
# Update velocity
|
||||
velocity += velocity * delta
|
||||
#velocity += velocity * delta
|
||||
velocity = input * speed
|
||||
|
||||
|
||||
if Input.is_action_pressed("shoot"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue