For my school project I make a round pong with four players. The game area is defined with a collider and script. In the script, I managed to split the game area to two players. If the ball flies up, the lower player gets the point and when the ball flies down, the top player gets the point. How can I make that for 4 players? How can I split the game area for 4 players?

Can someone help me?

Here is the complete Script:

extends Node2D

var screen
size
var var1 = 0
var var2 = 0
var var3 = 0

set
process(true)
screensize = getviewportrect().size
set
process_input(true)

func process(delta):
if ((ball.get
globalpos().y < 0) or (ball.getglobalpos().y > screensize.y) or (ball.getglobalpos().x < 0) or (ball.getglobalpos().x > screensize.x)):
reset
match()

func resetmatch():
ball.set
pos(Vector2(screensize.x * 0.5,screensize.y * 0.5))
ball.setangularvelocity(0)

func input(event):
if event.is
actionpressed("btnreturn"):
OS.getmainloop().quit()

func onPlayAreabodyexit( body ):
var Area = getnode("PlayArea")
var distance = body.get
pos() - Area.getpos()
if(distance.y < 0):
var1 += 1
get
node("Scores").getchild(0).settext(str(var1))
if var1 == 10:
print("Player 1 win")
else:
var2 += 1
getnode("Scores").getchild(1).set_text(str(var2))
if var2 == 10:
print("Player 2 win")

in Engine

In the callback method `on_PlayArea_body_exit` you read the ball's position and you know the position of the center of the play area. The vector "distance" points from one to the other, so you just check whether it points up or down (y is positive or negative).