Image:
Author: Xray Group: Default Filesize: 5.54 kB Date added: 2021-11-28 Rating: 5 Downloads: 927 Views: 372 Comments: 29 Ratings: 1 Times favored: 0 Made with: Algodoo v2.1.0 Tags:
|
Here's how it works:
1. The collision layer of the gun (it is collision layer A) should be different from the projectiles (bullets). Here the collision layer for bullets is B (in the script menu, layer B is shown as 2).
2. The laser does not need to be directly in line with bullet trajectory. I moved it at an angle so that the laser won't interfere with the bullets in any way. (e.pos is the x/y position where the laser beam hits the square). The bullets shoot straight away from e.pos because I made the velocity [50,0] which means they will shoot straight out from e.pos (in the positive X direction) at a fast velocity. I made the Y value zero so that the bullets will shoot parallel to the ground, rather than at a positive or negative slope.
3. I made the Ctrl key a trigger. You can poke it quickly for a single shot, or hold it down and the gun will be a machine gun.
4. Notice that there are MANY parameters that you can change in order to make the bullets look and act differently (color, velocity, size, and many other things) than they currently do. Play around with those parameters so that you understand what they do and how it makes the bullets interact with other geometries in the scene.
Oh, one more thing I forgot to mention: It's good practice to make the ground plane a "killer" and have the same collision layer as the bullets. If the bullets don't get deleted, they will pile up and eventually there will be so many that it will cause slow computers to LAG. You can either let that ground plane kill them, or in the script that generates the circles you can make each one have a timeToLive of some short time period like maybe 1 second, or maybe 0.1 second (whatever works for your particular scene).
Have fun! |
Last edited at 2021/11/28 21:04:48 by Xray
Please log in to rate this scene
|