Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jonathangersam on May 06, 2013, 04:37:08 PM

Title: Top Down Shooter, Strafe Logic Help
Post by: jonathangersam on May 06, 2013, 04:37:08 PM
Hi,
Pls help, I'm making a top down twin stick shooter.
I'm having trouble with displaying Strafe Left/Right animations.

Basically, setup is:
1) Player: ControllerSimpleMove, relative to Camera
2) Player: LookAt at target in the world
3) Camera: SmoothLookAt the player

I'm not sure what should be the logic to differentiate between
1) Moving toward target
2) Moving away from target
3) Strafe Left of the target
4) Strafe Right of the target

I've got mecanim graphs setup already, but what logic to pass animation parameters to it?
Do you guys have an idea for this? Thanks!

(http://db.tt/wW68xtYq) (http://db.tt/wW68xtYq)
Title: Re: Top Down Shooter, Strafe Logic Help
Post by: Lane on May 06, 2013, 04:52:47 PM
Are you asking about Mecanim setup or how to do the character movement?
Title: Re: Top Down Shooter, Strafe Logic Help
Post by: jonathangersam on May 07, 2013, 12:57:17 AM
Hi,
Actually it's more about character movement.


To be specific, my character moves around the screen ok,
But I need to be able to differentiate between moving
1) Toward target
2) Away from target
3) Strafe left of target
4) Strafe right of target
so I can feed correct values into mecanim.


Here's what I have now:


Thanks!
Title: Re: Top Down Shooter, Strafe Logic Help
Post by: foxhideous on May 09, 2013, 01:20:39 PM
You could try to play the animation depending on the button pressed(w=walk forward, a=strafe left etc.)
Title: Re: Top Down Shooter, Strafe Logic Help
Post by: jonathangersam on May 09, 2013, 02:04:39 PM
Hi,
Tried that one but didn't work. Since the game is top down, the W/A/S/D keys function as Up/Left/Down/Right based on the screen. but they don't map nicely to heading toward/away from target, or heading to left/right of target.


To illustrate the following scenarios:


,-----------------------,
|                       |
| (player) ---> (enemy) |
|                       |
'-----------------------'
If player were on the left of the enemy,
'D'/Right key would mean "move toward target".




,---------------------,
|                     |
| (enemy)             |
|                     |
|(player) --->        |
|                     |
'---------------------'

If player were on the bottom of the enemy,
'D'/Right key would mean "move to right".




Thanks,
Title: Re: Top Down Shooter, Strafe Logic Help
Post by: Lane on May 09, 2013, 02:13:25 PM
I dont really understand what kind of control system you're actually trying to make, but you can change the transforms from World coordinates to Self coordinates in your actions, that would allow you to use "forward" as W and with Self coordinates it wouldnt matter where the camera was looking it would just find the player's forward and go that direction. If you are looking at the enemy then it would always move toward it since the look direction is forward. Strafing would also be relative to the player.

Is that what you're trying to do?