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. Feedback
  3. Add a block to point at closest clone/ closest clone of a certain sprite

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

Scheduled Pinned Locked Moved Feedback
6 Posts 4 Posters 2.0k Views
  • 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.
  • SirBotsS Offline
    SirBotsS Offline
    SirBots
    wrote on last edited by SirBots
    #1

    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

    CreatiCodeI 1 Reply Last reply
    0
    • SirBotsS SirBots

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

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

      @sirbots

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

      SirBotsS 1 Reply Last reply
      0
      • CreatiCodeI CreatiCode

        @sirbots

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

        SirBotsS Offline
        SirBotsS Offline
        SirBots
        wrote on last edited by
        #3

        @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

        CreatiCodeI 1 Reply Last reply
        1
        • SirBotsS SirBots

          @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.

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

          @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?

          SirBotsS 1 Reply Last reply
          1
          • CreatiCodeI CreatiCode

            @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?

            SirBotsS Offline
            SirBotsS Offline
            SirBots
            wrote on last edited by
            #5

            @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

            CreatiCodeI 1 Reply Last reply
            1
            • SirBotsS SirBots

              @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.

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

              @sirbots

              We have added 2 new blocks to make it easier to work with clones. Please check them out there:

              https://www.forum.creaticode.com/topic/2032/2-blocks-to-scan-for-clones

              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