How to make a clone create clones?



Yeah 1 at a time


Yes like that! How do i do it


Ok, got it. Getting ready to drive somewhere, so I’ll have to explain a bit later on


Ok thanks! Guess I’ll wait


Ok so what I’m going to try to explain is definitely a more advanced aspect of Hopscotch

I’d start by suggesting you use a different object for the projectiles. Whenever to you spawn any of the “people”, also spawn a projectile.

This will give you a list of objects like this:



The bold objects are the original objects on the stage. The others are clones with clone index in ( ). The interlaced order (switching between People and Projectile) is important.

Now you have to use “intraframe communication” to pair the projectiles with the people. That involves using global variables to pass data from People clone N to Projectile clone N. But the variable(s) have to immediately be reset so values don’t get passed on to Projectile clone N+1

I’ll give an example of simply setting a projectile position to match the person it’s paired with. The person’s X and Y location have to passed to the projectile using variables specifically allocated for this purpose (in other words, don’t use the same variables for other things). We’ll use PassX and PassY as our variables.

We need to start my setting these to an appropriate default value. That might be 0, in which case you don’t have to do anything. But let’s assume you might want to set a position of 0, so we’ll use -9999 as our default

When Game starts
    Set PassX to -9999
    Set PassY to -9999

When a specific person needs to set the location of it’s projectile, set the variables to any location or a location with an offset

Set PassX to (self)x position
Set PassY to (self)y position + 15

Now the projectile (which is the next object in the list of objects) needs to receive the data

When PassX ≠ -9999 or PassY ≠ -9999
    Set Position x (PassX), y (PassY)

Note: The passed values have to be used in the very first block in the above rule (if you have more than one block in it). Otherwise, use the first block to set to value to an object variable.

Now we don’t want this data to get passed to the next projectile, so the values have to be reset during the same frame. We’ll need more rules for this

When PassX ≠ -9999
    Set PassX to -9999

When PassY ≠ -9999
    Set PassY to -9999

And that’s it. Use the same technique to communicate additional data between the person / projectile pairs as needed.


So I basically need to do a variable for x and y of every stickman?


No. I’m happy to answer questions but you asked that so quickly that I’m assuming you didn’t read my long post very carefully. Please re-read and think carefully about the explanations. I didn’t write a lot just because I like typing. :wink:


Oh ok… lemme read again


Oh so I need to restart and reset the same variable?


But what if I want to fire the projectiles?


Yes, all of the people use the same variable to pass data to their projectile, even if multiple people are passing data during the same frame (that’s why the interlaced order of clones is so important)


If some might fire while others don’t, you could use the same technique to pass a different variable to tell the paired projectile to fire.

Or if they all just start firing when the battle begins, you’d probably just need a global variable that for example gets set to 1 when you want the projectiles to shoot. The projectiles can then manage for themselves resetting and shooting again


Ohh I understand! Thanks, but could you explain a little bit more about the only variable that manages every projectiles position?


There’s 2 in my example. PassX and PassY

Note though that they’re not entirely controlling the location of projectile(s). They’re just passing data to set the position at 1 point in time (e.g., before you shoot). You’ll still use normal Set Position or Move Forward methods to make the projectile move.


Oh ok! I think I understand! Thanks for the help @ThinBuffalo!!!
I gtg ok bye


I can help I know clones I’ve had hopscotch for a while…


Well it’s something that’s a little bit complicated…


Yeah I know…