0 votes

So, I recently followed Heartbeast's platformer tutorial where he taught us how to do a platformer movement which I absolutely loved, I made a RayCast and then slapped code to flip the RayCast

extends KinematicBody2D

const UP = Vector2.UP
const GRAVITY = 20
const SPEED = 200
const JUMP_HEIGHT = -500
var motion = Vector2()

onready var rayCast = get_node("RayCast2D")

func _physics_process(delta):
motion.y += GRAVITY

if Input.is_action_pressed("ui_right"):
    motion.x = SPEED
    rayCast.cast_to = Vector2(50,0)
elif Input.is_action_pressed("ui_left"):
    motion.x = -SPEED
    rayCast.cast_to = Vector2(-50,0)
else:
    motion.x = 0

if is_on_floor():
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
motion = move_and_slide(motion, UP)

but now I have a question.
In a Platformer Prototype I am making, I have these ladders on the left side of the platform that when you jump next to em and the raycast is colliding with them and you hold a button, its supposed to stop the movement and freeze you in place and then when you hold jump button it should move you up and then you can continue platforming.
Would really appreciate the help :"D

in Engine by (27 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.