### PONG game problem

• Posts: 13
1.how to make a powerup that when the ball hit from the last paddle and then hit the powerup, that person gets a powerup. I couldn't find a way to make this.If a player shoots a power up their paddle speed will increase.

2.Every 8sec the paddle speed will slower. This effect resets when someone scores a point.
can someone teach me how to do this...

#### JeffreyDriver

• Posts: 2196
You need to use attributes to achieve these things. Have you used them before?

Booleans will let you simply check if the paddle has been hit.
So when the ball hits the paddle, set it to true, when it hits a brick or a wall, set it to false.
If the boolean is true when it hits the powerup, run the code that triggers the powerup, if it's false, ignore it.

For the 8 second slow down, you'll need to store the velocity in an attribute so that you can refer to it later and make the ball slow down. Then every 8 seconds you would set the velocity to 'current velocity - amount (the amount to want to slow down by)'

To reset this, simple put a line in your existing code that adjusts the score to reset the velocity.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

• Posts: 13
I already use attribute for Boolean,but i still not understand how to use for power up.Can you show me example code for that

#### Bhoopalan

• Posts: 1019
What is that you want to achieve exactly with powerup? Can you show an example game?
If I helped you at anytime, help me back build my twitter followers

• Posts: 13
Dragon pong
Players fight for points by getting the dragon egg pass their opponent’s side. A player can shoot dragon egg hit. the speed of dragon egg will increase. First to 20 points win.

Player Action(s)
•   Shoot
o   When fire hit dragon egg.the speed will increase.

Game Object(s)
•   Special powerup (god speed)
o   If a player shoots a power up with ball/dragon egg their paddle speed will increase.

Gameplay Rule(s)
•   paddle speed become slower over time
o   Every 8sec the paddle speed will slower. This effect resets when someone scores a point.

Controls
P1
w=going up
s=going down
d=fire

P2
up=going up
down=going down
left=fire

• Posts: 13
i already make paddle slow every 8 sec but idk how to reset it  when someone scores a point.

« Last Edit: September 29, 2016, 07:43:32 am by radz »

• Posts: 13
plz help me someone

#### JeffreyDriver

• Posts: 2196
Can I see your code that registers when the player scores a point?

It should be a simple case of add code in that behaviour to reset the value of 'speednormal1'
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

• Posts: 13
this is my score code

• Posts: 13
help me anyone.thank you

#### Bhoopalan

• Posts: 1019
I'll share a screenshot shortly. But experimental and can't guarantee result.
If I helped you at anytime, help me back build my twitter followers

#### JeffreyDriver

• Posts: 2196
In the second IF and OTHERWISE IF blocks, you just need code to reset the speed. How is the speed value stored? Is it in an attribute?
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

• Posts: 13
Yup attribute

#### Bhoopalan

• Posts: 1019
Wait a minute! You want the speed to be reset within the <when self exits the scene> event? Then why not simply use the <set speednormal1 to > block? You will have it in attribute setters.
If I helped you at anytime, help me back build my twitter followers