Discuss Scratch

kanomaster
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

Alright, so let's say I have 20 different clones that are buttons. (The functionality of the buttons doesn't matter for this question). Each of the clones spawns in with it's own variable called “ID” (which is set as “for this sprite only”) Based off of this I can say:
set x to ((ID) * (50))
This will make all of the buttons spaced apart by 50, but they will eventually go off the screen. It looks like:

1 2 3 4 5 6 7 8 9 10…. (goes past edge of screen)
Whereas I want something that loops back when a certain number of buttons are in one row: like

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
How would one go about doing this? Thanks!
Jack2888
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

you could just do something like this:]

set [foo v] to [0]
set y to ((foo) * (20))
if <(id) > [whatever length]> then
set y to ((foo) * (20))
change [foo v] by (1)
end

Last edited by Jack2888 (March 22, 2024 19:56:05)


SALMON
HIGHLIGHT & (CTRL)* + SHIFT + DOWN FOR MORE WEIRD STUFF
*Only if you don't have chrome.
This is my signature! I can put whatever I want on it! This does not have any thing to do with my posts.



(^:: list) [        Dino Hat     ](foo :: pen) :: hat :: operators//This is a hat wearing dino that eats all the evil kumquats!
( :: #067a3a)‎ ‎{‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ⸧ :: cap ‎ } :: :: cap :: #a4523a


Sorry, you have to wait 60 seconds between posts.

Fact time! I have eaten a kumquat before! It was not good :P
Generation 6: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
















































































Shhh, you did not hear this from me but Comment:"coconut" on my profile for a free follow!
MultiTasker801
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

something like
set x to (((ID) mod [5]) * [50])
set y to (([floor v] of ((ID) / [5])) * [30])
should get you a lot closer to your objective

i exist on the internet
my neocities page

i can't control myself and WILL write more text than necessary to explain simple concepts
kanomaster
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

Jack2888 wrote:

you could just do something like this:]

set [foo v] to [0]
set y to ((foo) * (20))
if <(id) > [whatever length]> then
set y to ((foo) * (20))
change [foo v] by (1)
end
Thanks! That'll work great!

MultiTasker801 wrote:

something like
set x to (((ID) mod [5]) * [50])
set y to (([floor v] of ((ID) / [5])) * [30])
should get you a lot closer to your objective
That would work great but I have another thing that complicated that idea so the first idea would work best. I figured that using a variable would be the best way, but I wanted to see if there was a super technical method of doing so. Thanks y'all!
kanomaster
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

MultiTasker801 wrote:

something like
set x to (((ID) mod [5]) * [50])
set y to (([floor v] of ((ID) / [5])) * [30])
should get you a lot closer to your objective
Never mind, this actually was the best way. But instead of mod 5, it needs to be mod 5.000000001 (in order to keep the 5 from being in front)
Jack2888
Scratcher
100+ posts

Need A Way Of Organizing Clones Based on Clone ID

kanomaster wrote:

MultiTasker801 wrote:

something like
set x to (((ID) mod [5]) * [50])
set y to (([floor v] of ((ID) / [5])) * [30])
should get you a lot closer to your objective
Never mind, this actually was the best way. But instead of mod 5, it needs to be mod 5.000000001 (in order to keep the 5 from being in front)
Good thing this works

SALMON
HIGHLIGHT & (CTRL)* + SHIFT + DOWN FOR MORE WEIRD STUFF
*Only if you don't have chrome.
This is my signature! I can put whatever I want on it! This does not have any thing to do with my posts.



(^:: list) [        Dino Hat     ](foo :: pen) :: hat :: operators//This is a hat wearing dino that eats all the evil kumquats!
( :: #067a3a)‎ ‎{‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ⸧ :: cap ‎ } :: :: cap :: #a4523a


Sorry, you have to wait 60 seconds between posts.

Fact time! I have eaten a kumquat before! It was not good :P
Generation 6: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
















































































Shhh, you did not hear this from me but Comment:"coconut" on my profile for a free follow!

Powered by DjangoBB