I have a sensor that flips when it bumps into anything.
The sensor value goes up by 1 when it bumps anything.
Forever if sensor value is above 0
Decrease sensor value by -.1
2 clone circles at the sides of the screen move toward each other.
As the circles continually get closer together the sensor value increases faster than it decreases.
When the circles are almost touching, the sensor value is above 2.5
The clone circles forever check if the sensor value is above 2.5
and check if their x pos is greater/less than the sensors pos +30/-30
thanks, this is extremely difficult getting clones to detect/effect eachother without effecting every clone
I can't go through the code right now, but would this work if there were say 6 circles? Could it detect which clones bumped and make them invisible?
This is a very clever idea. And a good visual affect as well.
My first thought to expand on this was that if the 2 clones aren't moving orthogonally, "point towards" code could be used so the sensor tracks to the clones movements. However, the problem is still what to do when there are more than 2 clones.
I think you'd need individual sensors hard-coded to track each clone pair. For an even number of clones (N), this would be N(N/2 -1)+N/2 individual sensors (15 sensors for 6 clones. 55 sensors for 10 clones. 190 sensors for 20 clones. Etc). Perhaps I'm wrong there, but otherwise I don't know how you'd figure out (without significant lag) which specific clones bumped.
Even more problematic is how to hard-code an individual sensor to track 2 specific clones. Do you know how or if that's possible?
I've been tinkering with the "when clone bumps clone" problem for a week or two and came across a technique to predictably associate the clone of one object to the intrinsic properties of a specific clone of another object. But that only accomplishes 1/2 of the problem of tracking 2 specific clones. (Using an unrelated, to this topic, detection technique I think I can use that associativity to detect the individual bumps of multiple clones. Maybe I'll give that a try later today)
I'd never be able to do that I can't even code a game well
Awesome ideas, and yeah, I think you are on to something. Tracking each clone pair has the advantage of being very fast and distributed, but it does require a lot more work and hard-coding pairs, which really doesn't solve the general case of N clones. So far, I've been able to make a way that works for any amount of clones, but is a bit buggy and runs at about 0.5 fps, just by cycling through every x position and y position in increments of 50 (the diameter of the circle/square) and having the clones increase a value when they are near that x position and y position. If there is more than one clone in that area, then they change color. This is a very basic and crude way of detecting it that I'm sure you have thought of, and it is extremely slow, but I think it might be the basis for something. I think the only way to do it flawlessly requires tools we simply don't have yet.
Here's a link to the detection method I referred to before. I decided to post it here since it still uses sensors.
Or search for the project in Hopscotch under ThinBuffaloSr
(Edit: I just tried the link and it doesn't work right in the web player. Try opening it in the app to get the correct affect!)
I've utilized concentric sensors paired with each clone. This turns out to work reasonably well (I've tried up to 6 clones). And it "only" requires a number of sensors equal to the number of clones.
While it does take effort to set up the individual sensors, the code in the cloned circle is freed up to be as complex as desired without being repeated for individual objects.
It has a few misses where only 1 of the 2 bumped clones is hidden, but I think that's because both detections are occurring simultaneously and I need to a better way to serialize the "When BumpID > -1" events. That's not a core component of the demonstration so I'm not worrying about it.
The key to this working is achieving an associativity between a sensor & and the intrinsic properties of specific clone, so the sensors can all follow their "assigned" clone. Normally, external objects will only refer to the properties of the original clone. However, if you clone the external object (sensor in this case) that clone will refer to the properties of the most recently created clones of all other objects. So if you interlace the repeated cloning of the circle with a single cloning of each individual sensor, you'll have sensors (more specifically the clone of each sensor) that can each refer to the properties of a different circle clone. The original sensor objects are then simply not used. This is probably confusing so here's a timeline to demonstrate:
So when the sensors all execute this (below), they each refer to a different circle
I hope that makes sense. Do you think this is useful? I think this "clone to clone associativity" can be put to some interesting novel uses beyond clone bump detection, so I'm hoping some Hops will take the time to try and make some projects using this technique.
It's *thought* all over... ☹️
Any trouble? Can I help?
I made this demo by having a sprite continually check if a sensor value starting at 81 rising to 83 then back to 81 is equal to the clones sizes and setting it's position to the clone when the sensor value and clones size are equal.
The 3 clones sizes are 81,82,83
When the sprite bumps a wall, the clone can be affected as the clones x-y position are equal to the sprite.
A Hopscotch version is in the works.
By only having "Bumps" code for 1 sprite, this helps reduce lag
And a sprite could act as a sensor for 3 or more clones
Here is a hopscotch version
That is another really clever idea. Are you adding bump events to test how well it works in practice? I suppose it's only conceptually limited by how quickly the sensor can be passed around.
One observation, understanding that the project is just a demonstration, the donut would need to be bigger or else it'll continuously bump the clone it's located on. That was the reason I used a Unicode "thin ring", which allows the clones to be closer before being detected as a bump.
An idea I have for the clones is forever check if their x-y pos is close to the sprite and check its size value is not equal to the sensor value.
This should make a clone not occupied by the sprite to go invisible when near the sprite.
When a clone goes invisible set a value to 1 then 0 then set its position offscreen.
When the value is 1 the clone occupied by the sprite will go invisible and set its position offscreen
Thereby simulating a collision of clones.
I really like your code for clones escorting clones.
It creates some new possibilities for making projects with Hopscotch.
If you manage to get your clone collision code working perfectly, please publish a link so I can check it out.
I'm starting the code again.
I want to simplify it with using mainly " When" blocks and not "Forever check" blocks.
And just have 1 custom value "Size" used.
I think I can reduce the amount of blocks used by around half.
You seem a lot like @oio to me, the way you reply and explain coding and Maths.
If you aren't @oio , I apologize if you are offended in some way.
I think you are the only person I've chatted to on Hopscotch that is as smart as @oio
I'm very glad to hear that you're still working on the sensor code and looking forward to the next demo version. Ping me when I can have a look or anytime you want to discuss.
I appreciate the kind assertion. No offense taken. ️ I've noticed many very smart people using Hopscotch! I just think communication styles, attention to detail, and technical skills change with life experiences.
If you're willing to discuss, I'd very much like to ask you a question about a previous comment you made.
What is fps in this context? I'm assuming something per second. And how did you measure it? I'm interested in being able to benchmark and compare different sequences of Hopscotch code.
Additional off topic comments
BTW, condolences on the recent events. For what ever it's worth to you, in the short time I've been usng Hopscotch & the forum I've been very impressed by your maturity, wit, leadership ability, & technical knowledge (I'm not an easy person to impress). I do hope you decide to hang around. Even if you have no lost love for Hopscotch the business, I believe that sharp inquisitive coders such as yourself & Stradyvarious are very inspirational to other Hopscotchers and I'd be sorry to see you leave for good.
Can you screenshot the code?
You can search for the project under my username on Hopscotch and see or improve the code.
How do you talk so professionally? :0
Seriously, it's so professional I can't understand a word you're saying. XD
Is Stradyvarious your username? What's he project name?