This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

extends "res://Codes/"

var AsteroidSmall = preload("res://Scence/AsteroidSmall.tscn")
var AsteroidMedium = preload("res://Scence/AsteroidMedium.tscn")

export (float) var explode_force = 300

signal explode

enum Size {

export (Size) var size = Size.LARGE
var radius

func ready():
connect("explode", self, "
radius = getnode("Sprite").texture.getwidth() / 2 * get_node("Sprite").scale

func explode():
if size != Size.SMALL:
for i in range(0,3):
var offset
dir = PI * 2 / 3 * i
var asteroid
match size:
asteroid = AsteroidSmall.instance()
asteroid = AsteroidMedium.instance()
asteroid.position = position + radius.rotated(offsetdir)
velocity = linearvelocity + Vector2(explodeforce, 0).rotated(offsetdir)
sleeping = true

where is the mistake?

in Engine by (12 points)

Do you have a .tscn file at the path Scence/AsteroidSmall.tscn? This path is case-sensitive (or it will become so in an exported project, on Windows). Make sure you didn't make a typo in the path (if your folder is called Scene or Scenes instead, it must match).

The same thing applies to Scence/AsteroidMedium.tscn.

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 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.