0 votes

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 moveandcollide in order to obtain information about the collision.I WANT THE BLOCKS STATICS

Godot version 3.4.2 estable.official
in Engine by (14 points)

2 Answers

0 votes

I assume the blocks are "kinematicbody".
I think you added scripts to them.

//////////////////////////////////// change //////////
Make the blocks "Staticbody".
add group == group name = blocks
and let the "bullet" signal them
now bullet = Kinemetickbody2d
bullet = Area2D
and get "Bullet" Area2d.

example :
bullet scene (area2d)

if body.is_in_group("blocks"):

//// Blocks scene

func explode():

///////// Or
don't adding code to blocks
just add group
Bullet scene

    if body.is_in_group("blocks"):
by (755 points)
edited by
0 votes

I think you can solve this by simply using physics layers.
You can find them in project settings under 2d physics afaik

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected].org with your username.