How do I stop more than one sprite being dragged at the same time (sprite cannibalism)

I need help making code where you can only move one sprite at a time. At the moment when I drag a sprite it will grab more than one and att the sprites stack on each other. (I have the basic .dragged move to current x and current y for each sprite)

What you are experiencing is ImageSprite Cannibalism. See an example and a solution in Scott's advice

I would click that but my school made it to where I can't see it.

:cry: OK, try the copied advice:

Dec 7, 2015, 7:48:01 AM

Update 2015/12/07: The extra ImageSprite is not needed. Just assign an empty text block to CurrentISP instead of using PlaceholderISP in the TouchUp blocks

YouTube video:

When more than one ImageSprite can be dragged on a Canvas, unless precautions are taken beforehand they may get 'stuck' together.

This is referred to as ImageSprite cannibalism.

This App Inventor project demonstrates a simple method to prevent this from happening using an ice hockey rink example.

A global variable, an extra ImageSprite and a couple of if blocks enable only one of two ImageSprites to be dragged at a time:

Can you see this stuff now?ImageSpriteCannibalism.aia (31.2 KB)

1 Like