I’ve been trying to make a game as a little side project before Duet. I ran into a problem with all the archers targeting the same enemy! Could someone help With the code?
Game Link:
@Elixir in this bit of code:
Looks like you’re always referring to the same variable, mySprite8. That variable will always point to the last enemy created because it get’s reassigned every time an enemy is spawned.
One way you could fix this is to just select a random enemy each time, like this:
You have another similar bug on the next line: you’re always using the mySprite2 variable which again will only point to the last spawned archer. That means that all the arrows will always come out of whichever sprite was created most recently.
To fix this, drag the “sprite” variable out of the top of the event, like so:

Thanks a lot!
I have a follow up question: How would you make the calvary not do this weird teleporting glitch?
Here’s the link again:
I just realized, nobody would see this unless I reply or ping them, so look up plz!
@Elixir I think that bug is being caused by how you’re setting the initial position of the calvary sprites. Looks like you’ve duplicated the code in two places: in the overlaps handler where the sprite is created and inside of an “on created sprite of kind” event. You want to delete the one in the overlaps handler.
The “move to” block assumes that you don’t manually change the sprite’s position after the movement has started. If you do, you can get teleporting effects because “move to” snaps the sprite to the destination position at the end of the movement time.
Here’s a timeline of what’s happening:
- The overlaps event starts
- You call “create sprite of kind calvary”
- Creating the sprite triggers the “on created sprite of kind” event
- The sprite’s position is set and they start moving towards the dummy
- After the created event, the overlaps event continues to the next line and changes the position of the sprite
- When the movement finishes, the sprite is snapped to the destination position. However, because the position was changed, the sprite appears to teleport.

