Your code creates a bullet with direction 270 and a second one with direction 270+10. If the difference between those two bullets is 10, that means the middle is 5, therefore the true center of what you coded is 270+5. The problem is that your first bullet is created in the place you want the center to be instead of creating it a bit to the side.
In this particular case where you already know beforehand in which direction the double shoot is made (270) and how much the separation is (10) then you can adjust accordingly. You would need to change it to:
Another solution would be to change the for statements to something like this:
Code:
for (var i = -5; i < 6; i += 10) {
And you can leave the "direction = 270 + i;" just as it is.
As a side note, if you ever want to play with different values, you could try using more variables to set up more details. Like:
Code:
//whatever was before your example code
case bullet.double: {
var directionToShoot = whateverDirectionYouWantToShoot; //Replace this with the actual direction
var numberOfBullets = 2;
var angleBetweenBullets = 10;
var directionToStartCreatingBullets = directionToShoot - angleBetweenBullets*numberOfBullets/2;//You don't need to use () anywhere, operation order already takes care of everything.
for (i = 0; i < numberOfBullets; i++) {
with (instance_create_layer(x, y, "Bullets", oBullet)) {
direction = directionToStartCreatingBullets + i * angleBetweenBullets;
speed = 5;
}
}
break;}
//whatever was after your example code
This should always work and allow you to experiment easily with different settings.
Hope that helps.
Edit: By the way, it took me a while (and several reads) to understand the problem. Next time try to clarify even more details in your post. Like specifying that the square in the top is the one shooting downwards, or what do you meant with "centered".