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

Get help using Construct 2

Post » Sun Aug 10, 2014 6:03 pm

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
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 20
Reputation: 424

Post » Thu Aug 14, 2014 5:14 am

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.
;)
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Aug 14, 2014 10:23 pm

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!
B
6
S
1
Posts: 20
Reputation: 424

Post » Fri Aug 15, 2014 2:49 am

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Aug 15, 2014 5:05 pm

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)
B
6
S
1
Posts: 20
Reputation: 424


Return to How do I....?

Who is online

Users browsing this forum: Anonnymitet, atmas, gamecorpstudio, tarek2 and 30 guests