I need help with my Ping pong with a bot game

I am working on a Ping Pong game that has an AI bot in it. I am having trouble with some things.

  1. How do I make a sensing block that sets the x/y position of a sprite to the x/y position of another sprite?
  2. I need help with a function that makes the ball "bounce" without it getting stuck or rotating on the paddles.
  3. Please suggest ways to set up a point system and score leaderboard(I am confused how to do so).

I've tried setting the position to mouse x/y but I need to set it to the x/y of the ball not the paddle. I've also tried using rotation blocks and basically this code.
You can go to my projects and click on Ping Pong with a bot to access the project(its a WIP so points have not been added), I will also share the project link.


Project link:

Please help and post any ideas, thanks in advance!

For #1, you can use Tamagotchi script pic (3) to get the position of a sprite. You can do Tamagotchi script pic (4). If you only want the x or y position, you can change the first input of the block and do this:
Tamagotchi script pic (5)
Tamagotchi script pic (6)

OK thx!(I'm new to snap so the whole layout of the code is unfamiliar to me)

Did you come here from Scratch? If you did, you can go to settings and choose "Single Palette". It will help a bit.

Yes I did thank you for the tip

Also, do you know how to make a updating point system visible to all players?

Like using a variable?

I mean like making a point system where if you hit the other player's side then you get a point.

Do you also have any suggestions for number 2?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.