Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. Projectile not showing up on layer

Projectile not showing up on layer

Scheduled Pinned Locked Moved Help and Support
22 Posts 3 Posters 464 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RobinsonXR Offline
    RobinsonXR Offline
    RobinsonX
    wrote last edited by RobinsonX
    #21

    IMG_9048.png
    The shooting logic is located in the Joystick object. I'll briefly explain how it works.

    1. Joystick Input triggers while using the joystick.
    2. 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.3s so you can only shoot one bullet every 0.3 seconds.
    3. It spawns an object (the projectile), then it sets the spawned object's rotation to the angle from the Joystick Input.
    4. We perform sine and cosine Math Functions on the angle to get the horizontal and vertical components respectively. These output a value between -1 and 1.
    5. 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.
    6. 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.

    1 Reply Last reply
    0
    • RobinsonXR Offline
      RobinsonXR Offline
      RobinsonX
      wrote last edited by
      #22

      I think the hardest part here is getting the x and y values to move the object based on the angle. I guess we can add a shorthand way of doing that at some point.

      1 Reply Last reply
      0

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Search