timartinelli
Member
Help with Project Player + Weapon + Mouse
Hello, friends, I have a hard time defining how best my game works with the Sprites of Weapons + Mouse to do the sights.
See the image below, I made my Player without the arms to put the arms together with the Weapons, not if this is the best way.
But when the mouse is in certain position the gun looks strange on the player, giving a bad impression.
I thought about limiting the angle of the weapon in relation to the player but I do not know how to program it in the game maker.
I thought about making a Sprite of My Player Along with the Weapon for each Degree Example 45,90,135 .... so on, but I do not know if this is ideal.
This is my code for controlling the rank of the weapon.
Here I change the sprite sideways according to the angle.
If anyone can point me a way, or any tips.
if I can not I'll put the static gun even pointing in one direction. I did not want this if I could not.
Sorry for English, I'm using the translator.
Hello, friends, I have a hard time defining how best my game works with the Sprites of Weapons + Mouse to do the sights.
See the image below, I made my Player without the arms to put the arms together with the Weapons, not if this is the best way.
But when the mouse is in certain position the gun looks strange on the player, giving a bad impression.
I thought about limiting the angle of the weapon in relation to the player but I do not know how to program it in the game maker.
I thought about making a Sprite of My Player Along with the Weapon for each Degree Example 45,90,135 .... so on, but I do not know if this is ideal.
This is my code for controlling the rank of the weapon.
Code:
x = oPlayer.x + global.weaponArray[global.weapon,5];
y = oPlayer.y + global.weaponArray[global.weapon,6];
//Código para utilização de controle
if (oPlayer.controller == 0) // caso o controle esteja desligado
{ //teclado e mouse ativos
image_angle = point_direction(x,y,mouse_x,mouse_y);
}
else
{ //direções do analógico direito ativos
var controllerh = gamepad_axis_value(0,gp_axisrh);//gp_axislh R é de analógico da Direita H Horizontal
var controllerv = gamepad_axis_value(0,gp_axisrv);
if (abs(controllerh) > 0.2) || (abs(controllerv) > 0.2) //area morta
{
controllerangle = point_direction(0,0,controllerh,controllerv); //na posição de 0,0 recebemos os valores H e V do analógico da direita
}
image_angle = controllerangle;
}
Code:
// altera a sprite da Gun para a Esquerda
if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
}
else
{
image_yscale = 1;
}
if I can not I'll put the static gun even pointing in one direction. I did not want this if I could not.
Sorry for English, I'm using the translator.