1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Score for game pong

Discussion in 'Programming' started by Isa, Oct 1, 2019.

  1. Isa

    Isa Member

    Joined:
    Aug 31, 2019
    Posts:
    16
    I am making the game Pong and when there is a collision with one of my paddles, the score has to be +1
    Does someone the code for doing this?
    I already made a controller for the score but what code does I have to make??
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,709
    Is it normal these days for tutorials to not even teach how to add into a variable or handle them in general?

    Assume that the controller is called obj_controller, and you set up its variables like this:
    Code:
    pointsA = 0;
    pointsB = 0;
    
    Then you do this in the paddle's collision with the ball:
    Code:
    obj_controller.pointsB += 1;
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice