Looks like you're not logged in

Login or Register to continue

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Code Reference seems incomplete?InfiniteDazeIn the code reference for homing_rocket.gd, none of the Onready variables are there and it's missing the overriding of the on_area_entered function. 1 0 May. 16, 2025
  • Await physics frame and set_deferredfilthy-rookI understand the general idea behind both await physics frame and set_deferred, but I'm still having a bit of trouble wrapping my head around when to employ them. Should I strictly be considering the usage anytime the physics calculations are involved? If I understand correctly you want to utilize these tools when interacting with other physics objects by adding more to the scene or getting information about where they currently are. 3 0 May. 10, 2025
  • For some reason my rocket explodes multiple times and my explosions don't hit anythingBrain Siege GameworksSpecifically, my rockets explode several times despite my rocket having monitoring set to false by call deferred and my explosions don't get any overlapping areas when instanced, despite the call of that function being after awaiting the next physics frame. Homing Rocket: `func explode() -> void:` `...` `get_tree().current_scene.add_child.call_deferred(explosion)` `explosion.global_position = global_position` `set_deferred("monitoring", false)` `set_physics_process(false)` Explode: `func _ready() -> void:` `.`.. `await get_tree().physics_frame #wait for the physics to update.` `print(get_overlapping_areas())` `for area: Area2D in get_overlapping_areas():` `if area is Mob:` `var final_damage = damage` 6 0 May. 09, 2025
  • Just a reminder: be careful to not confund physics_frame with process_frame!Lucas PscheidtJust writing this down 'cause if I ran into this (since I'm used to using `process_frame` and had never used `physics_frame`), I imagine others might too. The explosion won't deal damage if you use `await get_tree().process_frame`, learned that the hard way and spent like 20 minutes trying to figure out why it was bugging out lol 1 0 May. 09, 2025
  • More you can do with the explosionBrain Siege GameworksThe explosion provided does flat damage to everything in it's area. However I've tried to make it more interesting by making it do damage proportional to the distance. There's probably more that can be done with it, it probably works though. ```gdscript extends Area2D var damage := 10.0 @export_range(0, 1) var falloff_strength := 0.5 @onready var animated_sprite_2d: AnimatedSprite2D = %AnimatedSprite2D @onready var collision_shape_2d: CollisionShape2D = %CollisionShape2D @onready var circle_shape_2d: CircleShape2D = collision_shape_2d.shape # Called when the node enters the scene tree for the first time. func _ready() -> void: animated_sprite_2d.play() animated_sprite_2d.animation_finished.connect(queue_free) await get_tree().physics_frame #wait for the physics to update. for area: Area2D in get_overlapping_areas(): if area is Mob: var final_damage = damage var distance = global_position.distance_to(area.global_position) var aoe_radius = circle_shape_2d.radius var multiplier = (distance/aoe_radius) final_damage = final_damage - (roundi(final_damage * multiplier) * falloff_strength) area.take_damage(final_damage) ``` 1 0 May. 08, 2025
Site is in BETA!found a bug?