Topic was automatically imported from the old Question2Answer platform.
Asked By
PERXEO
I’ve doing a ships game. The player is a ship wich can shot bullets. The enemies are other ships wich fly from up to down.There are, certains blocks wich are obstacles for my ship, and when any of the player’s bullets, strikes any of these blocks, the bullet (kinematicBody also) explodes, dissapears and all is ok, but … the block moves a bit, and I dont want that occurs. I’m using move_and_collide in order to obtain information about the collision.
I assume the blocks are “kinematicbody”.
I think you added scripts to them.
erase
move_and_slide
or
move_and_collide
//////////////////////////////////// change //////////
Make the blocks “Staticbody”.
add group == group name = blocks
and let the “bullet” signal them
now bullet = Kinemetickbody2d
change
bullet = Area2D
and get “Bullet” Area2d.
example :
bullet scene (area2d)
if body.is_in_group("blocks"):
body.explode()
//// Blocks scene
func explode():
queue_free()
///////// Or
don’t adding code to blocks
just add group
Bullet scene