1 Reply

I'm having a hard time understanding what you actually need, but I'm gonna give you a bunch of information that will hopefully get you in the right direction.

Are you trying to modify the demo to do something or do you want to create your own game with a dual analogue stick?

The best thing that I can recommend is that you learn how to script. It's not gonna be easy, but it will be super rewarding. Be happy, Unity 3d is a great place to start.

I'm gonna make a long recommendation, but I can guarantee you a few moments of "ah" and "ohhh" if you spend 1 hour on it and also read the documentation.

Also, there are a TON of great video tutorials on youtube. These can be a bit slow to sit through, but you'll learn.

1 - A good, focused start - Prime 31's UIToolkit

The best place for you to start looking at some simple demos of how some of this stuff works is to look at Prime 31's UIToolkit which you can use for Free with Unity Basic. It has great demos and documentation, take your time and read it. Gather some Star Wars inspiration and give yourself time and patience. (Prime 31's Cross-Platform UI Toolkit)

I'm not familiar with the Angry Bots demo but the following 7 steps will give you a basic top down shooter:

The UI ToolkIt will give you the project and the analogue sticks on the Android to start with.

Create a box on the screen

Make the left joystick move the box's position on the screen on the X & Y axis

Make the right joystick face the box in the direction that the right joystick is pressing

Now create a projectile in front of the box (you need the position and direction/forward vector to do that)

Add velocity to the projectile (use the direction of the box to direct the projectile)

You now have a 2d-ish top down shooter

2 - Download it, unzip it and open up a scene called Joystick Manager.

In this scene, you'll be able to find a dual joystick input system. If you were to build this on Android, it should work. This will show you how to read the input, how to get the sprites on the screen and since it has a lot of documentation, you can actually learn a little bit of scripting and how it all works.

I really recommend this library to learn many things.

3 - Pseudo Code & Logic to move, face direction & shoot projectile.

Now if you want to look at a bit of scripting. I'll give you a bit of fake-code (pseudo code) approach to it. The joystick demo already gives you the analogue sticks current position relative to the center of where they should be.

This basically means that the UIToolkit gives you the exact direction (vector) in which your character has to move and shoot. With a little bit of logic in there, this is how simple it could be (I'm over declaring variables so that it becomes a bit easier to read).

void Update( float deltaTime ) {
Vector3 movementDirectionVector = leftJoystick.position; // Making it clear. Left Joystick = MOVE
Vector3 weaponFireDirectionVector = rightJoystick.position; // Making it clear. Right Joystick = FIRE
// We move the player by a little bit each frame (deltaTime)
Vector3 thisFrameMovementOffset = ( movementDirectionVector * playerSpeed * deltaTime );
// new player position = current player position + offset
Vector3 newPlayerPosition = playerObject.transform.position + thisFrameMovementOffset;
//You'd add a lot more logic here to make this more smooth and interesting.
playerObject.transform.position = newPlayerPosition;
// make the rotation of the player object be the angle of the direction vector
// This probably isn't correct (I haven't messed around too much with rotations and quaternions in Unity),
// do a search on google on how to get an angle from a directional vector
playerObject.Transform.rotation = new Quaternion(weaponFireDirectionVector);
// weapon fire cooldown has to decrease somewhere
weaponFireTimer -= deltaTime;
// If the cooldown has reached 0.0 then the weapon can fire again
if( weaponFireTimer <= 0.0f ) {
// spawn the projectile
// the projectile should be a prefab with a rigid body with no drag and various other things
Projectile projectile = new Projectile();
// tell projectile to be in front of where the box is facing
projectile.transform.position = playerObject.transform.position + (playerObject.transform.forwardVector * distance);
// make the rigid body of the projectile have the right velocity
projectile.rigidBody.velocity = playerObject.transform.forwardVector * projectileSpeed;
// let's make sure that the weapon takes a certain amount of time to fire again
weaponFireTimer = 0.25f;
}
}