PulseNS
Member
Hi,
I'm creating a top down game based in space and have the spacecraft booster effects as a separate sprite.
The spacecraft has two booster points and I have saved them into an array boosterX and boosterY.
My problem is that I just can't seem to get the boosters to line up properly. They are always slightly out or just not rotating properly.
The sprite is 24 x 16 and the origin is centred.
I have this so far,
Create
Draw
Here is the output. The red circles are where the code calculates at, the blue arrows point towards where it should be.
This is probably extremely simple and staring me in the face, any help would be appretiated.
I'm creating a top down game based in space and have the spacecraft booster effects as a separate sprite.
The spacecraft has two booster points and I have saved them into an array boosterX and boosterY.
My problem is that I just can't seem to get the boosters to line up properly. They are always slightly out or just not rotating properly.
The sprite is 24 x 16 and the origin is centred.
I have this so far,
Create
Code:
// Booster Locations relative to origin
boosterX[0] = 0;
boosterY[0] = 3;
boosterX[1] = 0;
boosterY[1] = sprite_height - boosterY[0];
Code:
var spr = sBooster;
for(var i = 0; i < array_length_1d(boosterX); i++) {
var relativeX = x - sprite_width/2 + boosterX[i];
var relativeY = y - sprite_height/2 + boosterY[i];
var boostX = x - lengthdir_x(x-relativeX,image_angle);
var boostY = y - lengthdir_y(y-relativeY,image_angle);
draw_sprite_ext(spr,0,boostX,boostY,1,1,image_angle,c_white,1);
}
This is probably extremely simple and staring me in the face, any help would be appretiated.