A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flash pong help

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    5

    Flash pong help

    So I'm creating a flash version of pong, and the scene happens to use two balls, and two paddles. My problem is this: when the enemies ball contacts the players paddle, it seems to drag, sometimes all the way to the bottom of the paddle, before reversing its xspeed and changing directions. Can anybody think of any reason the hittest might be delaying? I also find it strange that the ball doesn't continue along it's x, there are no lines of code involving a zeroed out x speed.

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    When a Hit occurs - before reversing the direction try subtracting a pixel or 2 from _y and see if that helps ... whats happening is the hitTest probably remains true for a few onEnterFrames ... make sure that isnt the case ... hard to say anything else without seeing your code
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    5
    Thanks for the reply, you're right that's exactly what the problem was. I figured out that when the balls travel too slow they tend to stick to the paddle, anything over 10pixels per frame seems to work fine.

    But I've run into a new problem... All the buttons in my movie are sending the game back to Scene 1, you can imagine why that's frustrating. I refer to _root.gotoAndPlay([say 11 for example]) and instead of sending it to frame 11 on the current scene, it reverts back to scene 1, and I'm pretty sure it's continuing from scene 1's frame 11 instead.

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