level 2 - moving plattforms
level2 almost finished
This commit is contained in:
+9
-5
@@ -67,6 +67,8 @@ func _unhandled_input(event):
|
||||
|
||||
func _ready():
|
||||
color_rect.visible = false
|
||||
pipedetector_ground.position.y = 0
|
||||
collision_shape_2d.shape.height = 15
|
||||
|
||||
func _process(delta):
|
||||
# set camera
|
||||
@@ -89,7 +91,7 @@ func _process(delta):
|
||||
|
||||
func _physics_process(delta):
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
if not is_on_floor() and not on_pause:
|
||||
velocity.y += gravity * delta
|
||||
|
||||
# Handle jump.
|
||||
@@ -151,17 +153,18 @@ func _physics_process(delta):
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
if not on_pause:
|
||||
move_and_slide()
|
||||
|
||||
func grow():
|
||||
if not is_big:
|
||||
is_big = true
|
||||
collision_shape_2d.shape.height = 32
|
||||
collision_shape_2d.shape.height = 31
|
||||
pipedetector_ground.position.y += 8
|
||||
|
||||
func flower():
|
||||
if not is_big:
|
||||
collision_shape_2d.shape.height = 32
|
||||
collision_shape_2d.shape.height = 31
|
||||
pipedetector_ground.position.y += 8
|
||||
is_big = true
|
||||
is_flower = true
|
||||
@@ -172,7 +175,7 @@ func shrink():
|
||||
shrink_sound.play()
|
||||
elif is_big:
|
||||
is_big = false
|
||||
collision_shape_2d.shape.height = 16
|
||||
collision_shape_2d.shape.height = 15
|
||||
pipedetector_ground.position.y -= 8
|
||||
shrink_sound.play()
|
||||
else:
|
||||
@@ -180,6 +183,7 @@ func shrink():
|
||||
|
||||
func player_die():
|
||||
die_player.play("die")
|
||||
on_pause = true
|
||||
music.stop()
|
||||
|
||||
func reload_scene():
|
||||
|
||||
Reference in New Issue
Block a user