Lesson: Explosion and Jump Effects + Review

This commit is contained in:
Felipe M 2021-01-30 21:09:00 +01:00
parent 842f567ed7
commit 147199a012
Signed by: fmartingr
GPG key ID: 716BC147715E716F
4 changed files with 99 additions and 1 deletions

View file

@ -2,6 +2,7 @@ extends KinematicBody2D
const DustEffect = preload("res://Scenes/Effects/DustEffect.tscn")
const PlayerBullet = preload("res://Scenes/Player/PlayerBullet.tscn")
const JumpEffect = preload("res://Scenes/Effects/JumpEffect.tscn")
export (int) var acceleration = 512
export (int) var max_speed = 64
@ -70,6 +71,7 @@ func update_snap_vector():
func jump_check():
if is_on_floor() or coyoteJumpTimer.time_left > 0:
if Input.is_action_just_pressed("ui_select"):
Utils.instance_scene_on_main(JumpEffect, global_position)
motion.y = -jump_force
snap_vector = Vector2.ZERO
just_jumped = true
@ -107,7 +109,9 @@ func move():
if was_on_air and is_on_floor():
# Keep previous momentum when landing on slopes
motion.x = last_motion.x
create_dust_effect()
#create_dust_effect()
Utils.instance_scene_on_main(JumpEffect, global_position)
# Just left ground
if was_on_floor and not is_on_floor() and not just_jumped: