Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:35:06+00:00 2026-06-15T05:35:06+00:00

So far in this game, I’ve made it possible to check wall and paddle

  • 0

So far in this game, I’ve made it possible to check wall and paddle collisions, and then respond by running an animation to redirect the ball. However, I keep falling down when it comes to checking a lack of collisions. Neither else nor else if statements work, and secondary if statements fail to work as well – either within the main function or as a separate event. I’ve covered pretty much every possibility here, but I’m hoping one of you guys (mega-dependable as you are) can help solve this.

Example of collision code (separate functions):

var BallStop7 = function(){
    setTimeout(BallStop8, 850);
    setTimeout(Check1, 1000);
    //setTimeout(Check1, 1000);    
    if(document.getElementById('Paddle2').style.top=="251px");
    {
        document.getElementById('BallRebound6').id='BallRebound7';
        document.getElementById('BallRebound7').style.webkitAnimationPlayState="running";
    };  

};

var BallStop8 = function(){
    /**/ 
    document.getElementById('BallRebound7').style.webkitAnimationPlayState="paused";
    if(document.getElementById('Paddle1').style.top=="251px"){
        if(confirm("Draw. Would you like to try again?")){
            window.location="pingpongwars.tumblr.com";
        };
        document.getElementById('BallRebound7').style.webkitAnimationPlayState="paused";    
    };
};


var Check1 = function(){
    if(document.getElementById('BallRebound7').style.left=="13.739665985107422px");{    
        alert("Player Two Wins");
        document.getElementById('BallRebound7').style.visibility="hidden";
    };
};

Main function

var BallStop4 = function(){
    //setTimeout(BallStop5, 370);
    if(document.getElementById('Paddle1Return').style.top=="9px");
    {
        document.getElementById('BallRebound3').id='BallRebound4';
        document.getElementById('BallRebound4').style.webkitAnimationPlayState="running";
    };

    if(document.getElementById('BallRebound3').style.left=="30px"){
        alert("Player Two Wins");
        document.getElementById('BallRebound3').style.visibility="hidden";
    }
    BallStop5();
};

Jsfiddle: http://jsfiddle.net/zbMCC/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:35:09+00:00Added an answer on June 15, 2026 at 5:35 am

    You have extra semicolons in your code:

    if(document.getElementById('Paddle2').style.top=="251px");
                                                             ^ = empty statement
    { /* A block of code */ }
    

    In example above, if truthy, it executes an empty statement, and the codeblock will be executed anyway, despite of the result of the comaprison. Just remove all semicolons after ifs.

    if at MDN

    Also code blocks should not end with semicolon, unless they are a part of declaration or definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is far fetched, but I've received an IPA game from a
I am trying to implement -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath So far this is what
I would like to apply transition rules to elements with javascript, so far this
I need a variable to hold results retrieved from the database. So far this
I got this far: :~ curl -u username:password -d status=new_status http://twitter.com/statuses/update.xml Now, how can
Been at this far too long; trying to populate a field in a record
All my apps that i've created so far do this. It does nothing to
After cobbling together a few questions I've managed to get this far to showing
I have this so far but the Column 'name' is ambiguous, so I want
I tried this so far: <?php $error = ; $conn = pg_connect(host=localhost dbname=brittains_db user=brittains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.