Hello everyone,
I’m learning Godot from a FreeCodeCamp video that was uploaded about a year ago (v4.0). In the video, there’s a scene showing how to choose the CharacterBody2D: Basic Movement template without a built-in script, but I can’t seem to do that in Godot v4.4.1.
Firstly, thanks for your response. As I mentioned earlier, I am using V4.4 and I am trying to avoid the built-in script because I’ve heard that it is unstable and difficult to modify later on.
Does this mean that I can no longer use a template without enabling the built-in script?
Oh I thought they always were, but they are not. In 4.3 you can just load a template into a new script when attaching it without it being “built in”. Well I did not know that.
I just downloaded 4.4.1, created a new project, added a characterbody2d and loaded a template when attaching a script (not built in).
So yes, it seems to be working fine, and exactly as it always did.
Just in case you need it here is what is in the template:
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
So you mean you are able to call the template without built-in? That’s weird, let me try to rebuild my part and check. Thanks anyway, and will let you know later.
So I created a new characterbody2d real quick, with one collisionShape2d and one animateSprite2d. Yes, you’re right, it works, I can call it without build-in. Let me work out what the issue really is in my formal case.
So now I know the reason. I have no idea why there is a player.gd in my player file, which I believe I did not create such before. When the script, player.gd exists, I can do nothing but follow it only. Using template becomes not available.
So all things work, Case closed. I do apperciate your help!