hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Checking for something touching at the [x direction] of an object

    Scheduled Pinned Locked Moved Solved Help and Support
    6 Posts 3 Posters 615 Views 2 Watching
    Loading More Posts
    • 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.
    • I Offline
      iKatKing10362
      last edited by iKatKing10362

      So I want to check 'if there is an object to the left, right, up, or down of my object'. I tried 'collided' but i don't know how to do 'if colliding with nothing'. I'm basically trying to set my object to a specific graphic if there is another object to the left of my selected object. Any help would be appreciated. Keep in mind I can't use specific object as I'm planning for an in-game level editor that hopefully you can save your levels, either online or offline.

      if you check my replies I provided images of what I tried to explain

      iTap DevelopmentI 1 Reply Last reply Reply Quote 0
      • iTap DevelopmentI Offline
        iTap Development @iKatKing10362
        last edited by

        @iKatKing10362 do you want it to be touching it on the left or just anywhere left of it?

        1 Reply Last reply Reply Quote 0
        • TutorialDoctorT Offline
          TutorialDoctor
          last edited by TutorialDoctor

          Sounds like a fun logic problem.

          Let's think about what "to the right?" actually means. If you have an object A on an x-y plane and you want to see if another object B is to the right of that object, you are actually asking if the x-posiition of object B is greater than the x-position of object A. If it is, then object B is to the right of object A.

          You can put copies of object B into a tag and check if the x-position of any item in that tag is greater than the x-position of object A. This may work.

          0_1492180831117_IMG_2127.PNG

          I 1 Reply Last reply Reply Quote 0
          • I Offline
            iKatKing10362 @TutorialDoctor
            last edited by

            @TutorialDoctor I can't use individual objects. I forgot to mention it is going to be a level editor, let me show an image of what I mean: Example image
            As you can see when in the level editor( when implemented) someone previews their level, I want the blocks to automatically change sprites to the edges and such.
            Hope this helps.

            1 Reply Last reply Reply Quote 0
            • I Offline
              iKatKing10362
              last edited by iKatKing10362

              Also it would be nice if someone could explain multiple connections, like the following image to me. Multiple Connections

              It will help making the normal none-player-designed levels easier to craft too

              iTap DevelopmentI 1 Reply Last reply Reply Quote 0
              • iTap DevelopmentI Offline
                iTap Development @iKatKing10362
                last edited by iTap Development

                @iKatKing10362 you could use @mc-games's grid example and then keep track of which places have an object. Then an object can just check and see if the spot next to it is taken, and if it is, set the graphic to whatever.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post