0 votes

Hi! I'm new on godot, and as a blind person, I use a plugin which makes godot accesible for screen readers. Actually i'm doing the first game tutorial... but I can't draw the points in the paht 2d node, because the plugin doesn't have accesibility implemented for that. Is possible to do that in other ways? Thanks

in Engine by (14 points)
retagged by

1 Answer

+1 vote

Hi,

The points from a Path2D node are defined in a Curve2D. This can be access via curve. You can add points with add_point(coordinate : Vector2) to the Curve2D

Here is a simple example how to make a "Z" (ZickZack) as a Curve2D for the Path2D:

extends Path2D

func _ready() -> void:
    curve.add_point(Vector2(0, 0))
    curve.add_point(Vector2(10, 0))
    curve.add_point(Vector2(0, 10))
    curve.add_point(Vector2(10, 10))

I hope this will help you.

by (1,536 points)

thank you! so with the curve 2d i don't need to close the curve like in the editor, right? If I script some path in ready I only have to write the curve positions?

You don't have to close the curve in the editor. there is an option to close it, but that is optional. Just keep in mind that this is a "sharp"-curve, so no bezier-action or something is in action.

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 Frequently asked questions and 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 [email protected] with your username.