Projectile not showing up on layer
-

The shooting logic is located in the Joystick object. I'll briefly explain how it works.- Joystick Input triggers while using the joystick.
- Debounce adds a cooldown so it doesn't shoot every frame. It limits how often its child behaviors are executed. In this case, it is set to
0.3sso you can only shoot one bullet every 0.3 seconds. - It spawns an object (the projectile), then it sets the spawned object's rotation to the
anglefrom the Joystick Input. - We perform sine and cosine Math Functions on the
angleto get the horizontal and vertical components respectively. These output a value between-1and1. - These components are multiplied because -1 and 1 is too small of a range. You'd probably want your projectiles to travel further than that.
- Move By moves the spawned object by the multiplied values.
In conclusion, while holding the joystick, the player will shoot a bullet every 0.3 seconds angled at where the joystick is. Depending on the angle, the projectile moves in a particular direction.
In the spawned object, you can add whatever logic you want. In this case, I made the projectiles emit particles and destroy themselves when colliding with an object with the "Wall" tag.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login