This is the project I have been working on. I have been able to create a shooting function but am having trouble with three things. I’m using an origin point inside the gun barrel to create clones and then launch them forward. I would like to give these clones physics so they bounce off walls, however, whenever I try this the origin point falls through the gun. Furthermore, I would like to improve my collision. So far, the program can only detect the original origin point, not the clones. Lastly, I want to add a function where the player can place objects. The player should be able to press a key to get a wall with 50% opacity, then press another key to place the wall. Does anyone know how I can achieve these steps?
- To enable physics for the origin copies, you can make the origin static and “set static off” for copies.
- To improve collision, you can give every cloned item a name and check the name of collided with the boy object.
- To add a wall, you can copy the existing wall and place it in front of the camera to specified position. If you store the current wall, you can place it when the other key is pressed.
I created an example space with this changes. I have also added a bullet disposal - every bullet after creation goes to the list and after 5 seconds is removed from the list and from the scene.
Press W to create a new wall and Q to store it.
Feel free to remix the Space to explore the code.
Hope that helps