Hi there, so I’m trying to make a very basic combat system. The easiest way to visualize what I am going for is the combat of Pokemon Go (no I’m not trying to make a clone) where the player can strafe left and right, but will always be facing the target. I am also trying to impliment a forward and backwards movement that is similar (player jumps forward/backwards by a specific amount)
So where I’m having trouble is the forwards and backwards movement. Essentially I only want there to be 3 distances the player can be (close medium and far) so I’m curious what the logic would be to allow forward movement when I’m medium or far, but not when I’m close. Do I use if/else statements? Is there a simple way to make it work?
I’m also wondering, should I make the player actual strafe left/right when the button is pressed, or should I parent the player to a central object and just rotate the object to make it look like the player is moving?
Is this going to be in 3D? If so I would potentially just use three seperate empty gameobjects, most of what you describe is going to be about perspective. If it’s with 2D sprite’s you would have to draw whatever graphics at different scales to match the perspective of near, medium and far within your game and then you would just instantiate your specified sprites across the screen until you’ve got the right look.
Or wait, actually with the way Unity works, you could just decrease the scale but you would have to make sure it works with the sprite you have, anything detailed probably wouldn’t work very well.
Hm, empty game objects actually might work really well for how I want it to work. It would probably simplify the logic too. I can just have the player jump back and forth between game objects rather than moving a specific amount.
That’s what I’m thinking, after that, the rest is just going to be animations and so on, you could as well even use lerp for smooth movement between the points, but that would be down to you to set up.
I got the rotation movement nearly done, simple code but it jumps with movement rather than smoothly moving.
if (Input.GetButtonDown ("Horizontal")
{
transform.RotateAround (target.transform.position, Vector3.down, speed);
}
I tried adding * Time.deltaTime to the speed variable but it didn’t seem to change anything. Is there a way to make it move smoothly rather than jumping?