Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Godot: Spawning items based on the points in a Path2D object
extends Node2D
export (PackedScene) var Star
export (int) var total_stars = 0
export (int) var stars_found = 0
func _ready():
var pos_curve = $ItemPositions.get_curve()
total_stars = pos_curve.get_point_count()
for i in range(0, total_stars):
var star = Star.instance()
add_child(star)
star.position = pos_curve.get_point_position(i)
@arihans

This comment has been minimized.

Copy link

@arihans arihans commented Jun 6, 2018

What is ItemPositions ??

@tzekid

This comment has been minimized.

Copy link

@tzekid tzekid commented Jul 3, 2018

@ArindamHans Have you worked it out? I couldn't find any Godot Node with the function .get_curve(), but pos_curse is simply a Curve2D Node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.