I am currently working on a game (top down shooter) and have recently started messing with making the mobile version controls. The game is gonna be Dual joystick on mobile with the left one controlling movement, and the right one controlling character direction (aiming) and shooting.
My left joystick functions correctly and controls the movement, my right joystick is supposed to angle my character according to which angle the joystick is being pushed in.
Instead of aiming where the joystick is pushed, it doesn’t rotate my character properly and seems to be tracking some invisible spot on the map. It slightly moves but doesn’t follow the direction the joystick moves. Screenshots attached below. (Edit: can only put one screenshot unfortunately… I will just show the code)
There is a position on the map that if I stand by it, my character will somewhat rotate in that direction. Below is the only code I have for the joysticks. This is seriously the only problems i’ve encountered creating this game the last month. I am using the SpriteMultiTouchJoystick extension for this. I appreciate any help!
Hi and welcome here
I’ve never tried those, but I wonder if the stick control action isn’t supposed to turn the character already.
Did you untick the rotation setting in the topdown properties?
Maybe try displaying both joystick angle values in a text object, and see what angle both output and if you make any sense out of them.
Thank you! I unticked the “rotation” for top down on the character. No change, outputting both joystick angles in a text was a good idea. I also made the characters angle output to a text too. Using the movement joystick doesn’t affect character angle. (Besides when I get close to that random spot on the map) The aiming joystick is the same as character angle so thats good. The weird thing, is that spot on the map that it seems to want to angle my character at.
As far as I know the only thing my character should be aiming at is the joystick angle. I feel like whatever my character is aiming at on the map is causing the problem.
What do you mean? The angle is correct, but it doesn’t show as such?
Yeah the angles for the 2nd joystick and my character were the same but it didn’t show. I believe it is fixed now, I deleted both Joysticks, removed the extension and re-installed it. Now they both work as intended.