A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Breakout - A little starting trouble

Threaded View

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    Breakout - A little starting trouble

    Hey everyone

    Im in the game making part of Flash as it is a great way to learn alot of different methods of doing things as well as learning new Actionscript , and also because you have something impressive to show once your done


    Well a little while ago I came across a tutorial here on Flashkit that showed me how to make the basic engine for the Classic Breakout game, though the author of the tutorial's english wasnt all that great, I was still able to piece it together


    Now Im running into a problem (I have attached the .fla)


    1) I have three walls which are each a seperate movieclip (left, top, right) and each has the code in it that checks for a hittest with the ball

    2) I have a unseen Movieclip (the black ball on the outside left of the stage) that controls the direction of the ball
    Basically in this movieclip 'moving', there are four different frames each with its own movieclip

    3) Each of these 4 seperate movieclips contains the code
    tellTarget (_root._root.ball) {
    _x -= 10;
    _y -= 10;
    }
    Except the + and - are arranged differently depending on which direction the ball will be moving


    To help you I will tell you which frame inside the movieclip 'moving' moves the ball in which direction

    Frame 1 = Up-Left
    Frame 2 = Down-Left
    Frame 3 = Up-Right
    Frame 4 = Down-Right



    Now I tried going about this by having a variable 'direction' inside the 'moving' movieclip that begins at one since the ball starts in the Up-Left moving direction

    Everytime it hits the wall or the paddle, it checks to see what value this direction variable can be (1,2,3 or 4). Depending on which it is, it'll go to the different frames in the moving movieclip


    When I run the program it works (try) except for when it goes Down-Right and hits the right wall, for some reason it will just go right through it


    Anyways, sorry for the length thread and hopefully it will make sense. If not, perhaps you can make sense of my .fla

    Thanks everyone, hopefully you can help
    Last edited by Osteel; 05-01-2009 at 02:39 AM.

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