A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [mx]Problems with motion not reversing in Breakout game

Hybrid View

  1. #1
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575

    [mx]Problems with motion not reversing in Breakout game

    Hi,

    i have coded a very simple version of "Breakout" HERE
    The whole thing works great bar one small problem.

    I can't understand why the ball does not reverse it's _x/_y movement when it rebounds into a brick from another brick - Hit a brick from the bat - no problem, but get behind a brick & then hit that & the ball merrily carries on in it's original path.

    fla attached.
    Last edited by pup100; 01-04-2008 at 08:38 AM.
    You will know everything when you know you never will.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe try something like this...

    Code:
    for (i in thisOne) {
    	if (thisOne[i].hitTest(_root["ball" + h])) {
    		my_sound.start();
    		var dir = (_root.xMover < 0) ? 1 : -1;
    		_root.xMover = thisOne[i].xMove * dir;
    		points = points + (thisOne[i].how);
    		thisOne[i].removeMovieClip();
    		break;
    	}
    }

  3. #3
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575
    Many thanks yet again dawsonk.

    Seems so easy when the logic has been pointed out to you!

    A reply over & above the call of duty having to read through & help out on all that spaghetti code! - Cheers again mate.
    You will know everything when you know you never will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center