Help with PONG, please?

Get help using Construct 2

Post » Tue Jul 11, 2017 12:29 am

Hi,

I am trying to make a PONG game. Basically, on bar on LEFT one on RIGHT and a BALL.

Figured ou most of it, except I cannot make barLEFT (Will be automated - player by computer), I would like to have barLEFT move by itself and follow.Y of BALL.

In other words, player will be playing against computer but barLEFT must be controled in a logical way that it tries to deflect the ball back in an attempt to defeat Player.

Help, please.

Thank you.
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Tue Jul 11, 2017 8:26 am

For Pong I guess you would set the bar's Y to the Y of the ball and to adjust the difficulty you put in delays for its speed in getting to that Y.
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Tue Jul 11, 2017 8:42 am

If you search the Tutorials (I prefer to search via Google) then you will find many examples to learn from, including some with basic AI - the second result is a video tutorial that has basic AI.

Maybe worth a look.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,374
Reputation: 58,430

Post » Tue Jul 11, 2017 11:49 am

In the most basic terms:

Ball.Y > BarLEFT.Y
? Add ( dt * x ) to BarLEFT.Y
: Subtract ( dt * x ) from BarLEFT.Y
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Tue Aug 01, 2017 1:05 am

Thank you all! Sorry I couldnt reply sooner. Thank you all!
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Tue Aug 01, 2017 12:26 pm

Condition: Every Tick
Action: Paddle(Sprite) Then Set Y =
Expression: Ball.Y
B
8
S
2
Posts: 24
Reputation: 548


Return to How do I....?

Who is online

Users browsing this forum: JoyfulDreamer, StillSarah and 23 guests