Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Spafnar |
I recently wrote a code that would allow a fireball to shoot out from the bottom of the playerview, and then would be affected by gravity and fly back downwards. The purpose of the code had to do with flipping v, and ultimately the code had to check for the global position instead of the velocity. This is the code:
var direction = “up”
var last_pos = global_position.y
func _process(_delta):
if last_pos < global_position.y:
last_pos = global_position.y
direction = "down"
elif last_pos > global_position.y:
last_pos = global_position.y
direction = "up"
match direction:
"up":
$Sprite.flip_v = false
"down":
$Sprite.flip_v = true
I was happy to see it finally flipping like I wanted to, but after closing the debuger I noticed there was a large amount of errors in my debug menu. It was as follows:
“get_global_transform: Condition “!is_inside_tree()” is true. Returned: get_transform()”
There was 26 of them and I’m guessing that number comes from how many fireballs I allowed to spawn. Does anyone know what this error does or is, and if it affects anything.