playMaker

Author Topic: diagonal Axis (2D, 8-way directional aiming)  (Read 2866 times)

mr.ffish

  • Playmaker Newbie
  • *
  • Posts: 9
diagonal Axis (2D, 8-way directional aiming)
« on: June 17, 2013, 08:27:56 PM »
I am having trouble figuring out how to use my axis events to properly set up smooth diagonal transitions. I used get axis and created float variables for x and y, but my first state always jumps directly to my up right diagonal state. it seems like it is always registering the variables as positive. Does anyone know a better way to have diagonal axis states?  I am trying to create 8 way directional aiming similar to Contra. Any Help would be MUCH appreciated.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: diagonal Axis (2D, 8-way directional aiming)
« Reply #1 on: June 17, 2013, 08:33:27 PM »
I ran into the same issue doing the side scroller template im working on. I just added a small value into the float when it registers that the character is pointing in a direction so that it stays in that state. If you check that template you'll see what I did and maybe you can use that method for the other 6 directions.

http://hutonggames.com/playmakerforum/index.php?topic=4025.0
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

mr.ffish

  • Playmaker Newbie
  • *
  • Posts: 9
Re: diagonal Axis (2D, 8-way directional aiming)
« Reply #2 on: June 17, 2013, 09:31:29 PM »
Thank you for your reply, I looked at your example, and it doesn't really seem like there is anything in it that correlates to my issue. I am trying to check for the axis sign (positive or negative) so that when i am in my right state, if the y axis is positive, it will go to my up/right state. I can achieve this with just using the axis events, (like if up is pressed while in right state = up/right) however, it isnt smooth at all, i want to be able to press up/right on the D-pad from Idle, and transition to up/right without needing to first hold right, then shift my thumb up.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: diagonal Axis (2D, 8-way directional aiming)
« Reply #3 on: June 17, 2013, 09:54:17 PM »
Sure, just make a state that checks which axis you're pushing and move into it, then you force it to stay there by changing the axis float(if it is even required). In that state you can just send a global event (for simplicity) based on what the axis direction is that goes into one of the 8 direction states, where the same axis checks are repeated.

There's probably a better way to do it, honestly, but that will work. I did it for two directions and overcame the 0 being considered positive, so it can work for more directions.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

mr.ffish

  • Playmaker Newbie
  • *
  • Posts: 9
Re: diagonal Axis (2D, 8-way directional aiming)
« Reply #4 on: June 17, 2013, 10:02:06 PM »
How did you overcome the 0 being positive? thats really the only issue i seem to be having, my whole process seems like it would work fine if it didnt immediately see the float variable as a positive. i feel like im just missing something very simple here.