Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Add a block to point at closest clone/ closest clone of a certain sprite

    Feedback
    2
    5
    166
    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.
    • SirBots
      SirBots last edited by SirBots

      This could save so much effort into making a decent targeting system for top-down shooter games and stuff.

      Your local coder who is working around the clock to make sure great games are made

      info-creaticode 1 Reply Last reply Reply Quote 0
      • info-creaticode
        CreatiCode @SirBots last edited by

        @sirbots

        Can you describe in more detail what would be the input parameters and how the block would work?

        SirBots 1 Reply Last reply Reply Quote 0
        • SirBots
          SirBots @info-creaticode last edited by

          @info-creaticode
          So, as a block to fit in operators (for example: If touching - (closest clone of -sprite name-) then)

          Based on what the closest clone is, it would calculate the distance of the closest clone of the target Sprite from the clone or sprites location. Once the distance is calculated, then (As an example: See which clone is the closest, and if that distance is in a certain parameter of what Sprite is preforming the calculations with the block from where its at, then it would affect what code is gonna run.) it does the same for other clones of that target sprite, and changes the closest clone (use the ID for the number), accordingly when updating.

          So, simply put, it calculates where all clones of a target sprite is at, stores the coordinates, repetitively updates, and then points at whatever clone is the closest to it. Now that I think about it, this might need multiple blocks for each function.

          Your local coder who is working around the clock to make sure great games are made

          info-creaticode 1 Reply Last reply Reply Quote 1
          • info-creaticode
            CreatiCode @SirBots last edited by

            @sirbots

            This needs some further discussion. Even if there is a block that returns the “clone ID” of the nearest clone of another sprite, you will still not know that clone’s x/y positions, right? So how would you calculate the distance to that clone?

            SirBots 1 Reply Last reply Reply Quote 1
            • SirBots
              SirBots @info-creaticode last edited by

              @info-creaticode I have 2 solutions to that.

              1: Have the find closest clone automatically log each clone’s x and y coordinates of the target sprite every time it’s run.

              2: Add a block to calculate the positions of all clones of the target sprite.

              Your local coder who is working around the clock to make sure great games are made

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