Separating Sprite Touched From Dragged

17 views
Skip to first unread message

noodl...@hotmail.com

unread,
Apr 4, 2013, 3:10:34 PM4/4/13
to app-inventi...@googlegroups.com
Hello all,
 
     I am new to designing apps and am learning more every day. I have made a game where multiple sprites start at the top of a canvas and move towards the bottom.  When a user touches a sprite it resets to the top of the screen, then begins moving towards the bottom again.

  My problem is that I can swipe across my screen and it will reset all sprites I moved across.  Thus making it possible to repetitively swipe the screen and keep all sprites pinned against the top of the canvas, which in turn kills the game play.

My question.  Is there a way to make it so nothing happens at all when I drag across or fling a the sprites? 


Some things I have tried using:

In hopes of leaving the image where it was...

      WhenDragged --> MoveImageSprite  --> ImageSprite.X
                                                                ImageSprite.Y


In hopes of only moving ImageSprite if starting touch began on the same X axis...

      WhenDragged --> IF Test--> ValueStartX  >=  ImageSprite.X
                               THEN DO --->  IF Test ValueStartX  <= ImageSpriteX + 50 (image size)
                                                     THEN DO ---> MoveImageSprite ---> Then I put in original starting location


Hopefully I am asking clearly enough.  Any help would be much appreciated. Thanks all.

noodl...@hotmail.com

unread,
Apr 6, 2013, 7:52:34 AM4/6/13
to app-inventi...@googlegroups.com

Solved with some help from user PhantomFoot. 

  I ended up making a variable with a value of true or false.  Then used when dragged to set the variable to false. I also used a timer to automatically set it back to true when not dragging.  Then when touched, test if the variable is true before moving the sprite.  Here are the blocks.


M Huret

unread,
Apr 6, 2013, 5:54:09 PM4/6/13
to app-inventi...@googlegroups.com
I initially had a lot of problem with dragging/moving sprites. I found something that allowed me to use layers. That helped since they were not erasing each other. the layering is in one of the tutorials

-=mh=-






--
You received this message because you are subscribed to the Google Groups "APP INVENTING WITH BDA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventing-wit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages