pixeltroid
Member
I have a lighting bolt weapon that is used when the attack button is pressed. It emerges from my players weapon barrel and lasts for 2 seconds before disintegrating.
The problem is that if I turn away the lighting projectile just stays suspended in mid air -- as shown below -- which i think looks stupid
Heres the code in my shoot button that activates the weapon script:
Heres the code that controls how the weapon is used:
How do I make it so that the lightning projectile is attached to the player at the co-ordinates specified in the code for as long as its supposed to last.
Any help would be greatly appreciated!
The problem is that if I turn away the lighting projectile just stays suspended in mid air -- as shown below -- which i think looks stupid
Heres the code in my shoot button that activates the weapon script:
Code:
if (state == 'move' && global.flame > 0 && health > 0 && global.weapon = 2 && !alarm[5] > 0)
{
{
scr_playerlightning_state();
image_speed = .5;
sprite_index = spr_playershoot2;
state = 'playerlightning';
}
canlight = false
alarm[5]=30
}
Code:
//create lightning
if ducking = true {
if (image_xscale > 0) {
l=instance_create(x+16,y,obj_lightning);
l.direction = 0;
l.image_angle = l.direction
l.speed = 0;
}
else {
l=instance_create(x-16,y,obj_lightning)
l.direction = 180;
l.speed = 0;
l.image_angle = l.direction
}
}
else if (image_xscale > 0) {
l=instance_create(x+16,y-9,obj_lightning);
l.direction = 0;
l.speed = 0;
l.image_angle = l.direction
} else if (image_xscale < 0){
l=instance_create(x-16,y-9,obj_lightning)
l.direction = 180;
l.speed = 0;
l.image_angle = l.direction
}
global.lightning -= 1;
Any help would be greatly appreciated!