2017년 8월 12일 토요일

only allow dragging of one animation object at a time?


I have 5 imageSprites and 2 Balls on my canvas and if I pick one up and drag it across the other animation objects on my canvas, it 'picks up' whichever object I drag across so eventually I'm dragging them all around the screen.  As they are being picked up, they actually 'disappear', but I believe they are just stacked on top of each other meaning I can only see the top-most sprite.  Obviously with them all stacked up I can't separate which one I want to drag.
What is the best way in AI to make sure only one animation object can be dragged at a time?
--
Check out my blockout game. I have a slider and multiple sprites.  http://TheAIRepository.info/source-code

--
Crusade,

I'm having the same problem!!

Tony,

Your blockout game only allows you to drag one item.  The problem happens when you have multiple sprites on the screen at once and all of them are drag-able.  If you start dragging one sprite, there is no function for App Inventor to detect when that sprite has stopped being dragged or dropped until you touch or drag a different sprite.  If you drag one sprite over top of another sprite that is drag-able, they will both pick up and be locked together -- being dragged together.

I have been fighting this for a few days and still haven't come up with a good solution by myself or here in the forum yet.
I've tried using disable, collision, pushing the objects around, etc with not a lot of success so far.

I can disable one of the sprites easy enough on collision, but getting it to enable and able to be dragged when I want to move it is causing some problems. (You can't drag or touch a sprite that's disabled).

The detect collision blocks will only detect the first collision but none afterwards.  For example, you have sprite 1 and sprite 2.  You drag sprite 1 to collide with sprite 2, sprite 2 will react accordingly -- move x, move y, etc., But if you continue to drag sprite 1 into sprite 2 again without touching any other sprite, the second collision is ignored and sprite 2 will be picked up and dragged along with sprite 1 -- both being dragged together.  You have to touch a different sprite and then come back to sprite 1 in order for the collision to work again -- but then again it only works once.

The goal would be a sort of leap-frog with your sprites.

I've searched for a good solution to this, but need some help!

--
Have you checked the issues list? This issue has been discussed on the forums and I believe an issue was posted about it. I don't remember the number, but star it when you find it.

--

댓글 2개:

  1. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you have to watch this video
    right away...

    (VIDEO) Why your ex will NEVER come back...

    답글삭제
  2. There is SHOCKING news in the sports betting world.

    It's been said that any bettor must watch this,

    Watch this now or quit placing bets on sports...

    Sports Cash System - Robotic Sports Betting Software

    답글삭제