![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | RBbooms |
I am trying to make a catch the falling objects minigame for a project i’m working on, but I am having some issues. To optimize things, I made 4 different rigidbody2d’s which fall to the floor at different speeds, and report a collision once touching the ground, and reset at the top of the screen at a random x-value. So far I’ve tried changing just position to global_position, and moving the object after freezing it on a call_deferred, but every time it changes its position visually, but the collision still is in the same place, and after unfreezing it snaps back to its first position. If this is an _integrate_forces() issue please explain what I should do for the syntax, as this is my first time doing stuff with rigidbody2d’s. Here is an example of one of my body_entered functions just for reference.
if body == $Ground:
lives -= 1
if lives == 0:
get_tree().change_scene_to_file("res://main_menu.tscn")
if body == $Player:
count += 1
$BallA2.call_deferred("set_freeze_enabled", true)
$BallA2.global_position = Vector2(randf_range(8,1144), 0)
await get_tree().create_timer(randf_range(3,7)).timeout
$BallA2.call_deferred("set_freeze_enabled", false)
Just to clarify, as I forgot to mention this: Once reporting that collision the ball is meant to freeze at the top of the screen for a small randomized amount of time before unfreezing and falling again. Thanks for any help, as both me and the discord I’m a part of are all stumped.
RBbooms | 2023-05-28 02:08