Ball to pass through the back of paddles for pong?

  • Hi i'm having trouble with making it so the ball in pong passes through the paddles in my pong-like game. I tried using the jump through behavior but it didnt seem to work. Idk if im just not using the behavior correctly but if there is an alternative that would be really helpful below are screenshots.

    remove the {{{

    http:{{{//puu.sh/60Gu3.{{{png

    http:{{{//puu.sh/{{{60GvX

    http:{{{//puu.sh/{{{60GwW.png

    All help will be greatly appreciated ty for reading.

  • I'm guessing this will probably do what you're after.

    dl.dropboxusercontent.com/u/108799982/Capx%20Demos/Pong.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • another version version 2

    this version brings in acceleration to a max speed of the ball (acceleration is just bullet acceleration and max speed is on line 9)

    it also slows down the ball as it passes through the bats.

    one version (line 4)checks to see if the ball is going over 100 and then halves it

    ball.Bullet.Speed>100 ? ball.bullet.Speed/2 : ball.Bullet.Speed

    (I've not used these conditional operators before but it appears to work <img src="smileys/smiley1.gif" border="0" align="middle"> )

    the other slow down is in (line 7)

    ball.Bullet.Speed-((ball.Bullet.Speed>200)*100)

    which takes 100 away from the speed if it is over 200.

    I also added a random change of direction to the ball as it passes through the bats

    ball.Bullet.AngleOfMotion+random(-30,30)

    line 8 is to just stop the ball getting stuck going backwards ad forwards between two bats.

    lines 5 and 2 check for collisions as I have turned off the solid check in bullets.

    lines 3 and 6 check to see if the ball is going at the correct angle to bounce

    else (lines 4 and 7)

    pass through the bat. slow down the ball (if going fast enough). turn on acceleration. bend angle of the ball.

  • <img src="https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/Ashampoo_Snap_2013.12.28_09h57m00s_001.png" border="0" />

    I guess it might have been worth making a function as 4 and 7 are the same ?

    Hope this helps

    (I certainly learnt something new about the conditional operator - which I've never used before)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)