Tennis game help


#1

Hi,

I'm just starting with hopscotch.

I want to make a tennis game.

I have 2 characters.

When the ball hits them it flips and moves forward. But it only does it once.

So the game lasts one shot each then the ball goes straight through the character and rests against the side.

I tried using repeat but the ball just goes back and forward regardless if it hits the character.

How can I make them continue to hit the ball?

I tried seeing similar games but the code makes no sense to me!

Thanks


#2

I can help... Try to do "When ball bumps player 1"
"Move forward (how long you want it to go)"


#3

Can I see some screenshots of the code?
I might be able to help :blush:
What is your hopscotch username?


#4

Hmmm...

@oio?
@Stradyvarious?


#5

Here is the code (hopefully)

I already have it set to 'bump' but only does it once


#6


#7

Did you make player two make the ball move forward -750?


#8

No, I made it flip and go forward 750


#9

Wait no...


#10

You need to add new values


#11


#12

Delete move forward 750


#13

Ok. I don't understand values. What do I have to do?


#14

I'll show you what to do via screenshot


#15

Thank you very much........


#16



Same code for monkey as octopus


#17

Thank you. I'll try that now


#18

Let me know if it worked


#19

Brilliant that works thanks.
(Although I'm not sure why - if you had time to explain why that works that'd be much appreciated!)

Now just have to get the angle right so it doesn't hit the top or bottom of screen and make the ball move faster and work out how to do scoring!


#20

Nice! This is how it works. Because you had move forward 750, the ball went past the character when the code was still running move forward 750...