https://file.io/1GAweOvsidUZ
I also made some correction to your random logic.
Please note that for example random(0,10)
will generate a random FLOAT number between 0 and 10.
Which generates numbers such as 0, 1.12478, 4.25176, and additionaly, it can never be 10.
To generate whole numbers like 1,2,3,4.... you need to use either floor()
or ceil()
to round to whole numbers.
For example:
ceil(random(5))
will generate either 1,2,3,4 or 5
floor(random(5))
will generate either 0,1,2,3 or 4
ceil(random(2,5))
will generate either 3,4 or 5
floor(random(2,5))
will generate either 2,3 or 4
Overall, your project is extremely inefficient and/or over-complicated.
Most things you did could be done with much less events and objects.
I suggest you look into: families, containers, functions, and use animation frames for different enemy types.
Not for performance reasons, but for you to learn how to do things faster/easier. So you don't have to copy/paste your code for every new dot type.
Differentiate looks with animation frames, and health or other logic with variables.
Or use families.
So instead of repeating click/death logic for each enemy type (in your case 3 times), it could be done by a single function. Within the function read the enemy animation frame and/or type variables to run different actions based on it.