ImageSprite drags by itself after repositioning with code

Hi everyone,
I’m working on a virtual pet app using MIT App Inventor, and I’ve run into a strange issue that I’ve spent the entire weekend trying to solve.

  • I have an ImageSprite (named Pollito) inside a Canvas.
  • Draggable is enabled.
  • The user can drag food sprites (like Pollito) to the pet (ImageSpriteSnark), and when they collide, the pet reacts.

The problem:
After the first collision and repositioning, Pollito starts moving on its own, even when I’m not touching it. It’s like it thinks it's still being dragged, even though I’m not interacting with it.

I’ve tried:

  • Replacing the sprite with a new one
  • Rebuilding the logic
  • Using set Velocity and set Direction to 0
  • Looking for a way to disable/reenable Draggable via blocks (which seems impossible — I understand now there’s no block for that)
  • Resetting origin and interval
  • Triggering repositioning via a Clock timer to avoid instant update
  • Testing in different browsers and devices

This a known bug? Is there any reliable way to reset an ImageSprite’s drag state after moving it with code? Or is there a workaround to force the drag state to stop?

Read the two articles on Sprite Cannibalizations at

Mr.ABG, Your article about avoiding sprite cannibalism was partly helpful, but now the main problem remains that after dragging a sprite (food) to the pet sprite, and after waiting a few seconds, the food sprite automatically drags itself to the pet sprite.

Export the .aia and post it here, for some one to look at.

A downloaded blocks image would speed things up if you upload that too.

Snark_tumascotapasivoagresiva (2).aia (678.5 KB)

Probably this:

image

The Pollito.x + 1?

It appears that you run a timer to "move" the Pollito sprite?

The timer is supposed to make the food sprites reappear after dragging it to the pet.

I see in Screen3 the food reappearing after a while.

You are missing a TinyDB tag, easy to fix since it is the only one you use in Screen3.

You are misusing Width Percent here:

Maybe you wanted to add or subtract 10 or 5 to that attribute of the progress label, and check that it stays within the proper bounds of 0 to 100?

That's another mechanic I wanted to implement, that a change would be reflected in the friendship bar when you give x or y food

Mr TIMAI2?

Try disabling everything that programmatically moves that Pollito sprite. Does it still move after you have collided it with the SnarkSprite ?

I removed all the blocks and put them back one by one to see which one it could be, and the error was in the clock "relojiniciobanderas"