playMaker

Author Topic: Top Down Shooter, Strafe Logic Help  (Read 3434 times)

jonathangersam

  • Playmaker Newbie
  • *
  • Posts: 11
  • A startup indie hobby developer. Nice too meetcha!
    • View Profile
Top Down Shooter, Strafe Logic Help
« on: May 06, 2013, 01: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!

@jonathangersam (twitter)
Platinum Toybox Studios

Getaway Driver School
http://gamejolt.com/games/arcade/getaway-driver-school/13839/

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Top Down Shooter, Strafe Logic Help
« Reply #1 on: May 06, 2013, 01:52:47 PM »
Are you asking about Mecanim setup or how to do the character movement?

jonathangersam

  • Playmaker Newbie
  • *
  • Posts: 11
  • A startup indie hobby developer. Nice too meetcha!
    • View Profile
Re: Top Down Shooter, Strafe Logic Help
« Reply #2 on: May 06, 2013, 09:57:17 PM »
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!
@jonathangersam (twitter)
Platinum Toybox Studios

Getaway Driver School
http://gamejolt.com/games/arcade/getaway-driver-school/13839/

foxhideous

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Top Down Shooter, Strafe Logic Help
« Reply #3 on: May 09, 2013, 10:20:39 AM »
You could try to play the animation depending on the button pressed(w=walk forward, a=strafe left etc.)

jonathangersam

  • Playmaker Newbie
  • *
  • Posts: 11
  • A startup indie hobby developer. Nice too meetcha!
    • View Profile
Re: Top Down Shooter, Strafe Logic Help
« Reply #4 on: May 09, 2013, 11:04:39 AM »
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,
@jonathangersam (twitter)
Platinum Toybox Studios

Getaway Driver School
http://gamejolt.com/games/arcade/getaway-driver-school/13839/

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Top Down Shooter, Strafe Logic Help
« Reply #5 on: May 09, 2013, 11:13:25 AM »
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?