Repelling attempt please help!

I’m trying to make the circles repel the rest and I got it to sort of work. but not very well as it should approach a hexagonal grid. Can someone debug it or tell me why it’s not turning into a hexagonal grid. I don’t have advanced mode.

6 Likes

you are using :iphone:Xpos and :iphone:Ypos. Those are game variables, which means they have one single value. To store multiple values, each one different for each object/clone, use self variables.

and i’m not sure what you’re coding, because your code won’t make the circle move on a hexagonal grid :thinking:

7 Likes

I’m trying to make the circles repel one another. Also the 2 vars you just mentioned are supposed to be normal vars because there for communication so that the rest of the clones know it’s pos and can all repel from that pos. The clones take turns setting the var to their pos. @Tri-Angle

5 Likes

okay, in that case, you should indeed use a game variable but implementing string, because clone #X can only see the position of clone #X-1, and not everyone’s position

5 Likes

What do you mean?

5 Likes

you have several clones. they set their position by replacing others in that variable, not adding. you should implement string, also called array or list, so every clones know everyone else’s position.

does it make sense to you?

5 Likes

Yes that does make sense but considering it would
a. Slow it down A LOT.
b. Have multiple clones trying to edit the list at once making only one succeed.
c. not speed it up do to the fact that the clones can still only repel from one clones at a time.
It doesn’t seem like a good idea.
@Tri-Angle

4 Likes

okay, i double checked how your code works and the concept is very interesting. You would not need Clone Index * 2 since the two Set variables next to it are updated in one frame, not two.


→ a. Trust me, no it’ll not.
→ b. How Hopscotch work with clones is that they run the entire code for the first clone, then the entire code for the next one, etc. It never failed in the past when i was working with string :))
→ c. Use custom rules with parameter. If you have 100 clones and 100 custom rules, the clones will be able to repel in one frame only.

i hope this answers your questions :))

4 Likes

a. How to make lists by Mathematics 2
b. That makes sense.

4 Likes

i know how to make lists lol :joy: but thanks

perfecto! tag me if you have any other questions :))

4 Likes

Ok tag: @Tri-Angle i don’t understand your response for C.

4 Likes

okay. let’s say your string of clone positions looks like this:

String = 0293,1024;0330,0029;0129,1002;

you’ll need to create a custom rule

🖍 Custom Rule Name(Index=“”)

Index is a parameter which you’ll input a number depending on which position in the string you wanna check.

In that custom rule, you’ll do the step to extract other clones’ position, compare these information and move to repel. Just like what you did but this would be faster


if that really doesn’t make sense to you, i can code it from your project if you don’t mind

5 Likes

I don’t mind at all. In fact I would like it if you could code it from my base project as that would probably take me at least a week thanks to my ADHD.

6 Likes

Did you see my response @Tri-Angle

1 Like

oops :sweat_smile: sorry for the super late reply
yep doing it rn

(t1 thanks for the likes! without them i wouldn’t see math’s post)

1 Like

Ok @Tri-Angle i saw your remix but didn’t understand it.

1 Like

i haven’t finished yet, i reached my daily Hopscotch limit

1 Like

Do you mean like a screen time limit?

1 Like

yep, i’m able to code today tho

1 Like

Great how long is the limit? 1 hour?

1 Like