PlayerOne
Member
Title says it all. I'm trying to get the player to shoot properly but the bullets keep moving at angle everytime the player character moves. Trying to make a metal slug style system where you shoot 4 ways. Any help is appreciated. I'm sure it's something simple I'm overlooking.
Code:
var _xx=0
var _yy=+(-24*aim)
var _xscale = image_xscale;
var _rotation=_rota
if (alarm[0]=-1) // If alarm is <= 0
{
if global.data[# 1,6]>0 // <<< Player ammo
{
var bullet = instance_create_depth(x+_xx, y+_yy, 5, global.data[# 3,6]); // <<< Create bullet and assign var
audio_play_sound(global.data[# 3,7],0,0) //Play Audio when bullet is created.
with(bullet) // <<< With created bullet
{
speed=10*_xscale+(2*_xscale);
direction=_rotation+irandom_range(-global.p_spread,global.p_spread);
}
global.data[# 1,6]--; // <<< Subtract player ammp
alarm[0]=30
}
else
{
//audio_play_sound(snd_gunshot_mainC,0,0) //Play Audio when bullet is created.
}