Sprite collision - do not allow pass through.

832 views
Skip to first unread message

spch...@gbaps.org

unread,
May 19, 2014, 10:44:04 AM5/19/14
to mitappinv...@googlegroups.com
I have a couple students who are trying to make a maze/labyrinth type of game for their final project.  They are using the orientation sensor to steer the ball and the object is to steer the ball without falling into the holes.  Our problem is this; every time the ball contacts one of the walls of the maze, it just passes through.  We've been pounding our heads against this problem for 2 class periods and haven't gotten any closer to a solution.  We've tried changing the heading, we've tried making the ball stop, bounce off the wall like the pong app, etc.

I hate when I can't help a student figure out a solution.  This can't possibly be as complicated as we're making it.  Can someone help me figure this out?


SteveJG

unread,
May 19, 2014, 12:20:38 PM5/19/14
to
Your maze walls are stationary sprites?   Perhaps  you might be able to use image sprite.when edge reached     or imagesprite.Bounce
                                                                                                                                                                                            edge    ?

perhaps there is something there.

Regards,
Steve

Taifun

unread,
May 19, 2014, 2:08:00 PM5/19/14
to mitappinv...@googlegroups.com
you might want to provide a screenshot of your relevant blocks
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

spch...@gbaps.org

unread,
May 19, 2014, 2:58:46 PM5/19/14
to mitappinv...@googlegroups.com
Thanks.  I've looked at all of those pages already.  The sample maze app just ends the game if the ball touches one of the sprites acting as a wall.  We need the game to continue.

As i understand it, Imagesprite edge and bounce are for when the sprite hits the edge of the canvas.

spch...@gbaps.org

unread,
May 19, 2014, 3:54:51 PM5/19/14
to mitappinv...@googlegroups.com
It works like we want it to if we have the ball move by itself, or if we make it move using the fling event.  Below are the blocks for how we made it work using the fling event.  What we need is a way to make it work when steering the ball with the orientation sensor.

Here's the blocks for doing this with fling.
Reply all
Reply to author
Forward
0 new messages