camera smoothing only on y
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user