( get_parent().add_child(fireball) fireball.position = $Position2D.global_position) ERROR

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ben74

so i watch a tutorial about power up the fireball
got just 1 error
and these are my code:
if Input.is_action_just_pressed(“ui_down”) && is_attacking == false:
if is_on_floor():
velocity.x= 0
is_attacking = true
if fireball_power == 1:
var fireball = FIREBALL.instance()
elif fireball_power == 2:
var fireball = FIREBALLRED.instance()
if sign ($Position2D.position.x) == 1:
fireball.position = $Position2D.global_position

Aaand… you haven’t provided what the ERROR is

USBashka | 2022-07-28 17:56

Hi ben, we’ll need a bit more information before we can help you fully. It would be good to know exactly what error you’re getting when trying to run your script. Also, the formatting for the code you pasted is a bit messed up. I’d ask that you use the code block option in the response box (looks like two bolded curly brackets: { }), then paste your code into the section provided, or ensure that there are four spaces in front of each line of code and a new line above the block to get the code-block effect to work. For example:

var code_example = 1
func exampleFunc():

Looks like this, where periods (.) represent spaces and a new-line above:
…var code_example = 1
…func exampleFunc():

Make sure to check the preview below your response to ensure it looks right. For now, we can’t tell where your indentations are so the intent of the script is lost.

DownloadFLD | 2022-07-28 20:36