llcolz.blogg.se

How to have two sprites touch once then bounce
How to have two sprites touch once then bounce











how to have two sprites touch once then bounce

No, you don't need to know all that, but you asked for "everything very thoughrouly". And I'll mention some stuff about raycast and area, and other queries at the end. Then filtering physic bodies and communication. Where & how to connect and write the codeįor this answer I will start by explaining collision layers and mask. Where and how do I add a collision shape 2d or area2d or other nodes along those lines. some examples of things I would like to be more clear are Please explain everything very thoughrouly as I have been trying for the past couple of days to figure it out but most of the places I have looked I didn't understand what to do and when I copied the code it didn't work. I want to detect when the mob touches the player and give an output finally I have the main scene with has the player scene inside it and instances the mob scene every so often to spawn mobs at the top of the screen. this scene only has the sprite and a tiny piece of code that makes it so that the mob deletes itself once it leaves the screen using the visibility notifier(I also turned of the mask square so there would be no physic). I also have a scene named "mob.tscn" which is a rigidbody2d node. this scene is a player which moves from left to right across the screen. one that is named "KinematicBody2D.tscn" which a KinematicBody2D node.













How to have two sprites touch once then bounce