Get help using Construct 2

### » 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.

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

### » 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
48
S
19
G
87
Posts: 2,317
Reputation: 51,518

### » 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
141
S
31
G
88
Posts: 5,745
Reputation: 61,503

### » 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: 254
Reputation: 2,332

### » 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

### » Tue Aug 01, 2017 12:26 pm

Condition: Every Tick
Action: Paddle(Sprite) Then Set Y =
Expression: Ball.Y
B
11
S
3
Posts: 24
Reputation: 723