camera smoothing only on y

This commit is contained in:
Jonas Braus
2024-08-05 00:19:18 +02:00
parent 6ef02c5628
commit a2f9549d15
17 changed files with 159 additions and 52 deletions
+1 -6
View File
@@ -6,15 +6,10 @@ extends Label
func _ready():
var platform = ""
match OS.get_name():
"Windows", "macOS", "Linux", "FreeBSD", "NetBSD", "OpenBSD", "BSD":
"Windows", "macOS", "Linux", "FreeBSD", "NetBSD", "OpenBSD", "BSD", "Web":
label.text = "A, S, D To Move"
label_2.text = "Space To Jump"
label_3.text = "E To Fire"
"Web":
label.text = "Swipe Left/W, S, A, D"
label_2.text = "Right Down Tap/Space"
label_3.text = "Right Up Tap/E"
"Android", "iOS":
pass
+3 -3
View File
@@ -16,9 +16,9 @@ func _on_body_entered(body):
func _process(delta):
if mover < 25:
collision_shape_2d.position.y += -1 if up else 1
animated_sprite_2d.position.y += -1 if up else 1
mover += 1
collision_shape_2d.position.y += -25 * delta if up else 25 * delta
animated_sprite_2d.position.y += -25 * delta if up else 25 * delta
mover += 25 * delta
func _on_timer_timeout():
innocent = false
+7 -2
View File
@@ -72,11 +72,16 @@ func _ready():
pipedetector_ground.position.y = 0
collision_shape_2d.shape.height = 15
var camera_target_pos_y = 0
func _process(delta):
camera_2d.position.x = position.x + 50
if is_on_floor() or velocity.y > 0 and camera_2d.position.y < position.y:
camera_2d.position.y = position.y if not is_big else position.y + 8
if is_on_floor() or velocity.y > 0 and camera_target_pos_y < position.y:
camera_target_pos_y = position.y if not is_big else position.y + 8
if camera_target_pos_y != camera_2d.position.y:
camera_2d.position.y += (camera_target_pos_y - camera_2d.position.y) * 10 * delta
# set camera
if position.y <= 32: