Cosmic clones mechanic?

so, you know how in sUpeR MaRio GalAxY, there are these cosmic clones that copy Mario’s movement to the exact position and hurt him on contact? well, i wanted to see if we could get a mechanic like that to work in makecode arcade. can we make that happen? can someone please make that work? (cough @richard cough)

After looking up what you’re talking about, I am realizing I should really look stuff up before opening my mouth.

I would start with this. Just a proof of concept. If you have more than basic movement in your game, you probably wouldn’t be able to just stick this code in there, especially if your character is animated, but this is a good starting point!

we’ve done this sort of thing on stream before and the code usually ends up looking pretty similar to what @WoofWoof just posted, which works pretty well! if you want the copies to animate in the same way as the sprite they are copying, then it might also make sense to store a third value every time you record a position in addition to x and y. i would put all of the possible animation frames for your sprite into a big array in on-start and then figure out the index of the sprite’s current frame whenever you record a position. then when you are setting the position on the copies, you can also set the image on the sprite based on the index into that array.

the only real problem with this approach is memory; if you want this game to run on hardware then you’re probably going to need to do some optimizations to prevent it from eating up all of the available RAM on the device. one optimization would be to make it so that you only have 1 clone following the player; for each additional clone you’re going to have to keep more positions in the array

1 Like