Posted May 19, 2020 by xSakix
After each +10000 score player gains another bullet.
For getting the starting points of bullets i used this algorithm:
https://stackoverflow.com/questions/3542402/partition-line-into-equal-parts
Which divides line into equal parts based on a weighted average of starting points.
var A = position.y - y/2-3;
var B = position.y + y/2+3;
for i in range(num_bullets):
var k = float(i)/float(num_bullets-1)
bullet_position = position
bullet_position.y = A*(1.0-k)+B*k
add_bullet(bullet_position)
'num_bullets' starts at 1.
'y' is the size of rectangle of the Player ships sprite texture in the respective scene.
+/- 3 is a magic number:)