How do I Do a Proper score for 2 players on opposite sides

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I'm working on a pong game, and I've got the movements and the ball pretty much fleshed out. The only thing I'm having an issue with at the moment is the score, I need to get it to update by 1 depending on what side of the map it exits from, now I've achieved it sorta with the ball hitting a certain X variable, but it doesn't work right...any ideas? I've posted my file below

  • x < -5 will add the score every tick that x < -5, which is why sometimes more than 1 point is added.

    having destroy outside layout on the ball also contradicts using numbers outside the layout (-5, 805) to set the score, which is why sometimes no points are added.

    The OCD in me also wants you to know that you're setting the ball's angle to a random position x(0-360), y(0-360) which is a position, not an angle, which is why the ball always starts facing in the same general direction.

    and to suggest reading tutorials. lots of them.

  • I realized that yesterday, Originally I had it to set +1 to score on it's destruction, however I need a way to determine what Side it exits from. I didn't know the angles random position would be a position, I thought it would be a random angle, am I right in guessing that it should be random(45,90,180,360), Random y (same) ? probably not, but I am making progress!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could do it on destroyed, just add another condition that checks which side of the screen it's on. You could also add the point as soon as it passes the paddle but before it gets to the edge of the screen (with a "trigger once while true" to keep it from counting continuously).. and many, many other ways!

    if there's an x and a y, that's always going to be a position. You've just got the wrong action, you're looking for simply "set angle" as opposed to "set angle toward position". then random (360) will work as you intended.

    Keep going! You'll get the hang of it.

    That's why I suggest doing lots of tutorials. They may not seem like anything you plan on doing, and there's a good chance you won't need exactly what they teach, but they'll get you thinking like a programmer.

  • I did the ghost shooter one, I'm thinking about the platformer one next! If I can get good enough with this and make what's in my head I'll have no issue buying a license (except for cash of course, but eh we all need that)

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