Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
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
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Help
  3. Overlap object detection is bugged or not working

Overlap object detection is bugged or not working

Scheduled Pinned Locked Moved Help
7 Posts 3 Posters 1.6k 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.
  • TheNicknameGovT Online
    TheNicknameGovT Online
    TheNicknameGov
    trusted helpers
    wrote on last edited by
    #1

    70f1ce7b-cb55-4ce9-b565-ea8e1cfcf9df-image.png

    I made sure both the player and the rope is present and named correctly

    https://play.creaticode.com/projects/6750e68aa80eece3de43d381

    I'm back!!!

    Tyller_T 1 Reply Last reply
    1
    • TheNicknameGovT TheNicknameGov

      70f1ce7b-cb55-4ce9-b565-ea8e1cfcf9df-image.png

      I made sure both the player and the rope is present and named correctly

      https://play.creaticode.com/projects/6750e68aa80eece3de43d381

      Tyller_T Offline
      Tyller_T Offline
      Tyller_
      trusted helpers
      wrote on last edited by Tyller_
      #2

      @011830-0a42ef84 is non blocking collision turned on for both?

      edit: I had looked over and is player the yellow box or is the avatar the player, if the avatar is the player object then that’s why

      <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
      </div>

      TheNicknameGovT 1 Reply Last reply
      1
      • Tyller_T Tyller_

        @011830-0a42ef84 is non blocking collision turned on for both?

        edit: I had looked over and is player the yellow box or is the avatar the player, if the avatar is the player object then that’s why

        TheNicknameGovT Online
        TheNicknameGovT Online
        TheNicknameGov
        trusted helpers
        wrote on last edited by
        #3

        @tyller_ I’m not sure what you mean. How do I detect collision with the rope so it can actually climb it?

        I'm back!!!

        Tyller_T CreatiCodeI 2 Replies Last reply
        0
        • TheNicknameGovT TheNicknameGov

          @tyller_ I’m not sure what you mean. How do I detect collision with the rope so it can actually climb it?

          Tyller_T Offline
          Tyller_T Offline
          Tyller_
          trusted helpers
          wrote on last edited by
          #4

          @011830-0a42ef84 is the player object (object with label player) the avatar or the yellow box, if it’s the avatar then the reason you can’t detect it is because both the rope and player have collision, so they collide with each other and can never overlap, overlap means they’re inside each other’s colliders, if the yellow box is labeled player then try turning on non blocking collision on that (and shrink it so the player can’t climb ropes from too far)

          <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
          </div>

          1 Reply Last reply
          1
          • TheNicknameGovT TheNicknameGov

            @tyller_ I’m not sure what you mean. How do I detect collision with the rope so it can actually climb it?

            CreatiCodeI Offline
            CreatiCodeI Offline
            CreatiCode
            wrote on last edited by
            #5

            @011830-0a42ef84

            The 2 objects, “player” and “rope,” are not in the same sprite, so when you run this “overlapping” block in the player sprite, it doesn’t know about the “rope” object. That’s why it is not working.

            Also, testing for objects overlapping frame by frame is very expensive. Since you already know the position of the rope, it is much simpler to check the distance between the player and the rope. You only need to calculate the 2D distance between them, and if it is a small number, then you know the player is very close to the rope.

            Also, the way you handle the key presses is not optimal. For example, in “when w key pressed”, you have the block to wait until key w is pressed or the object is blocked below. But when the w key is pressed again, this stack will be triggered again. Overall, this will make the project run slowly and not smoothly. Instead, we recommend you use a single forever loop to handle all keys and conditions, but each key press is handled instantly. You can check out this project for an example: play.creaticode.com/projects/66e823b5a634f8ee7d92cc88/editor?version=1

            TheNicknameGovT 1 Reply Last reply
            1
            • CreatiCodeI CreatiCode

              @011830-0a42ef84

              The 2 objects, “player” and “rope,” are not in the same sprite, so when you run this “overlapping” block in the player sprite, it doesn’t know about the “rope” object. That’s why it is not working.

              Also, testing for objects overlapping frame by frame is very expensive. Since you already know the position of the rope, it is much simpler to check the distance between the player and the rope. You only need to calculate the 2D distance between them, and if it is a small number, then you know the player is very close to the rope.

              Also, the way you handle the key presses is not optimal. For example, in “when w key pressed”, you have the block to wait until key w is pressed or the object is blocked below. But when the w key is pressed again, this stack will be triggered again. Overall, this will make the project run slowly and not smoothly. Instead, we recommend you use a single forever loop to handle all keys and conditions, but each key press is handled instantly. You can check out this project for an example: play.creaticode.com/projects/66e823b5a634f8ee7d92cc88/editor?version=1

              TheNicknameGovT Online
              TheNicknameGovT Online
              TheNicknameGov
              trusted helpers
              wrote on last edited by
              #6

              @info-creaticode

              When I use the distance between block, it doesn’t change value no matter where the player moves and just stays at the value 100000000.

              I'm back!!!

              CreatiCodeI 1 Reply Last reply
              0
              • TheNicknameGovT TheNicknameGov

                @info-creaticode

                When I use the distance between block, it doesn’t change value no matter where the player moves and just stays at the value 100000000.

                CreatiCodeI Offline
                CreatiCodeI Offline
                CreatiCode
                wrote on last edited by
                #7

                @011830-0a42ef84

                Please refer to this example:

                play.creaticode.com/projects/675378ad977fa780536fd819

                The idea is that we already know the position of the rope, then we just need to know the position of the player, then calculate the direct distance between these 2 2D coordinates.

                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

                • Don't have an account? Register

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