0 votes

"""
Scuse me when I use this code It doesn´t change the level, when I used the
old code It change the level but It doesn´t reconice my Player, because of
thet I chnged my cods but know the Player can´t activate the door, please
I would like to know what is my mistake if is somenthing in the menu or what ???
probably is somenthing in the ispector options ???? or I don´t Know
Now I ouse Godot 3.1 (I don´t know if the methodes changed)
Thank you for your answer

Disculpen mi pregunta es esta con este codigo no me coje el nuevo mundo
con el codigo que tenai antes que dejo abajo si lo pasa del 1 al 2, pero claro
hasta ahi llega, me gustaria saber donde esta el error por lo que les envio
el proyecto completo
Gracias por su respuesta ???
"""

extends Area2D
export (String, FILE, "*.tscn") var next_world

func physicsprocess(delta):
var bodies = getoverlappingbodies()
for body in bodies:
if body.name == "Player":
gettree().changescene("next_world")

"""
With this code it changed the world but my player doesn´t go to
the next world
Con este codigo cambiaba del mundo 1 al 2 pero con el codigo de arriba
no cambia el mundo porque ????

extends Area2D

func physicsprocess(delta):
var bodies = getoverlappingbodies()
print (bodies)
for body in bodies:
if body.name == "Player":
gettree().changescene("res://Scenes/Word2.tscn")

This is the original code that I Spoked

A este codigo que es el original que ya tenia desde hacia un rato
lo cojo y le sumo la siguiennte linea

Me devuelvo al World1 y en el ispector esta la variable world_scene

"""

This is the other section of the Player code but I think that the problem is in the other code

Platformer It doesn`t change the level

Please what´s the problem the script or the inspector options ?????

extends KinematicBody2D

const UP = Vector2(0, -1)

const GRAVITY = 20
const ACCELERATION = 50
const MAXSPEED = 200
const JUMP
HEIGHT = -550

var motion = Vector2()

func physicsprocess(delta):
motion.y += GRAVITY
var friction = false

if Input.is_action_pressed("ui_right"):

    motion.x = min(motion.x + ACCELERATION, MAX_SPEED) 
    $Sprite.flip_h = false    
    $Sprite.play("Run")      
elif Input.is_action_pressed("ui_left"):
    motion.x = max(motion.x - ACCELERATION, -MAX_SPEED)
    $Sprite.flip_h = true
    $Sprite.play("Run")

else:
    friction = true
    $Sprite.play("Idle")

if is_on_floor():       
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.2) 

else:   
    if motion.y < 0:         
        $Sprite.play("Jump")  
    else:                     
        $Sprite.play("Fall")  
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.5)

motion = move_and_slide(motion, UP) 
in Engine by (12 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.