Is there a way to make a parameter data type in a function optional? I'm trying to create a code that detects collision and automatically removes it from the list that they belong to. However, the objects that I will use collision on have different classes.
I want to make the code modular so that it suits different classes(that are stored in a list)
Cerberus:
Function LaserColl:Void(laserList:List<Laser>,againstList:List<Alien> Or <Shield1> Or <Shield2>)
For Local laser:=Eachin laserList
For Local against:=Eachin againstList 'removes laser and alien if collides
If Collision( laser.x, laser.y, 1,7,against.x,against.y,15,15) Then
laserList.Remove laser
currentScore += against.value
against.lives-=1
If against.lives < 1 Then
againstList.Remove against
Endif
Endif
Next
Next
End
I want to make the code modular so that it suits different classes(that are stored in a list)