Skip to first unread message

Nicolas Hernandez

unread,
Aug 6, 2015, 9:42:46 PM8/6/15
to MIT App Inventor Forum
Hello appInventors! I am having a bit of a problem with sprite collisions. I am working on app that has the user drag an icon across the canvas to a matching icon. What I want to happen is when the icons match, a sound plays, and the icons disappear. If the icons do not match, a diff sound (try again) plays and the icons remain. 

Unfortuantely, this isn't working for me. I have tried about 6 different ways of coding the blocks, but the same thing happens. The icons disappear when they collide with other icons (even incorrect ones). Strangely, this even happens when I remove my "when collide with" blocks". Any suggestions? I have included my collision blocks below.

Thanks in advance! 

Nicolas




Scott Ferguson

unread,
Aug 6, 2015, 11:19:17 PM8/6/15
to MIT App Inventor Forum
Your blocks look OK as far as the logic goes, but what you are seeing is a common problem whein one sprite is dragged over another one.
They lock together and only one will show on top but the other is being dragged underneath.
One name for this is sprite cannibalism and you can correct for this in a few different ways.
I have one solution you might use in this video. There is also a description here.
---
sf

Nicolas Hernandez

unread,
Aug 7, 2015, 12:27:28 AM8/7/15
to MIT App Inventor Forum
Scott,

Thank you for sharing this. It worked! I am so relieved. I spent close to a dozen hours trying to solve this. I really appreciate you taking the time to share your knowledge of this issue with me. 

Nicolas

Italo

unread,
Aug 7, 2015, 1:09:45 AM8/7/15
to MIT App Inventor Forum
I'm really into graphics and everything sprite related is very interesting to me.So I have a question. Nicolas: In your first post, you say that the sprites disappeared when colliding. As I see in Scott's solution, the sprites don't disappear but "stick" together. What caused them to disappear then?
Reply all
Reply to author
Forward
0 new messages