D
danne249
Guest
so this will be a bit tricky explaining on what i need help with that im have been stuck on for a long while (im not a good ex plainer).
its a topdown shoot im making
so basically i have succeeded with making the mouse to have having full control over where my character is looking based on the position of the mouse and with that have a standard idle animation when im not moving.
This is the code that im currently using in an step event.
//mouse controll
var dir = point_direction(x,y,mouse_x,mouse_y);
if(dir > 45 && dir <= 135){
// Up
}
else if(dir > 135 && dir <= 225){
sprite_index = character_idle_left_spr;
image_speed = 0.03;
// Left
}
else if(dir > 225 && dir <= 315){
// Down
}
else if(dir > 315 || dir <= 45){
sprite_index = character_idle_right;
image_speed = 0.03;
// Right
}
And right now im trying to ad 2 other commands to both directions, run animation and "aim" animation.
But the thing is i dont want the character to start to look in the right direction if im walking right and have my mouse to the left, so the mouse is still in full control over the animation.
i think i need to ad some sort of code on each dir saying for example on the right dir "if D key pressed, then right sprint animation will happen, else if right mouse button pressed, right aim animation happen" but this string of code can only happen if i have my mouse in the right dir "technically have the right dir code active".
But if i have the left dir code active, it will do like "if D key pressed, then left sprint animation will happen, else if right mouse button pressed, left aim animation will happen"
I hope this make sense for you guys, i have no idea on how to code this , and i cant find a clear answer on google or im just stupid.
its a topdown shoot im making
so basically i have succeeded with making the mouse to have having full control over where my character is looking based on the position of the mouse and with that have a standard idle animation when im not moving.
This is the code that im currently using in an step event.
//mouse controll
var dir = point_direction(x,y,mouse_x,mouse_y);
if(dir > 45 && dir <= 135){
// Up
}
else if(dir > 135 && dir <= 225){
sprite_index = character_idle_left_spr;
image_speed = 0.03;
// Left
}
else if(dir > 225 && dir <= 315){
// Down
}
else if(dir > 315 || dir <= 45){
sprite_index = character_idle_right;
image_speed = 0.03;
// Right
}
And right now im trying to ad 2 other commands to both directions, run animation and "aim" animation.
But the thing is i dont want the character to start to look in the right direction if im walking right and have my mouse to the left, so the mouse is still in full control over the animation.
i think i need to ad some sort of code on each dir saying for example on the right dir "if D key pressed, then right sprint animation will happen, else if right mouse button pressed, right aim animation happen" but this string of code can only happen if i have my mouse in the right dir "technically have the right dir code active".
But if i have the left dir code active, it will do like "if D key pressed, then left sprint animation will happen, else if right mouse button pressed, left aim animation will happen"
I hope this make sense for you guys, i have no idea on how to code this , and i cant find a clear answer on google or im just stupid.