Hello,
i am very new to godot, and a convert from unity 5... really trying to stay with godot, but also looking at cocos2d, however so far Godot is great, but so far just doing a simple platform tutorial, and i am looking at the KinematicBody2D, attaching the script to it, wondering, what is the difference between _PhysicsProcess and _Process in C#? i assume the same concept is the same for GDScript?
also got another question, when working on the 2d platform, i try to increase my velocity.x runspeed from 500 to 1500, and i dont see any increase, i do have gravity set to 1000, then lowered it to 500, but i still dont see any improvement on my running or jumping... what is going on? this is the same code found on https://docs.godotengine.org/en/3.0/tutorials/physics/using_kinematic_body_2d.html
public class KinematicBody2D : Godot.KinematicBody2D
{
[Export] public int RunSpeed = 1500;
[Export] public int JumpSpeed = -400;
[Export] public int Gravity = 500;
Vector2 velocity = new Vector2();
bool jumping = false;
public override void _Ready()
{
// Called every time the node is added to the scene.
// Initialization here
}
public void getInput()
{
velocity.x = 0;
bool right = Input.IsActionPressed("ui_right");
bool left = Input.IsActionPressed("ui_left");
bool jump = Input.IsActionPressed("ui_select");
if (jump && IsOnFloor())
{
jumping = true;
velocity.y = JumpSpeed;
}
if (right)
{
velocity.x += RunSpeed;
}
if (left)
{
velocity.x -= RunSpeed;
}
}
public override void _PhysicsProcess(float delta)
{
getInput();
velocity.y += Gravity * delta;
if (jumping && IsOnFloor())
{
jumping = false;
}
velocity = MoveAndSlide(velocity, new Vector2(0, -1));
}
// public override void _Process(float delta)
// {
// }
}