playMaker

Author Topic: Crossy Road type character movement  (Read 2791 times)

Pyper

  • Playmaker Newbie
  • *
  • Posts: 5
Crossy Road type character movement
« on: March 18, 2017, 12:24:42 AM »
I am a new user to Unity and Playmaker. I am not a programmer.

I am working on an ISO game, with the main character being controlled like CrossyRoad using arrows on PC or tap to hop forward/swipe to turn on tablet/phone.

I created a 1x2.5x1 cube as a temporary standin for the main character and made it a child of a game object called "cube controller".

I don't know how to deal with touch yet or animating the idle and jump. It just kinda slides for now.

I created a FSM on the game object parent to read they arrow key inputs. To make sure I am hopping forward by 1 cube unit, I just duplicated the player cube four times and moved each 1 unit ahead/left/right/behind (they are still a child of the game object) and turned off mesh renderer.

When an arrow key is pressed, I use 'Move Object' and 'I Tween Rotate To' to move the game object parent to the location of the ahead/left/right/behind cube. All the cubes move together, so it is ready for the next key input.

This is probably not the best way to do it!

One thing I noticed: although the cubes I am moving to are all 1x1x1, when I hit a key and the character moves, it does not move 1 unit like I thought it would.

Also, the movement seems to be overshooting and sliding back a little even though all my tweens are linear.

I've attached a picture.

Am I going about this totally wrong?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Crossy Road type character movement
« Reply #1 on: April 11, 2017, 02:19:07 AM »
Hi,

 Have you been able to make progress here?

 as for moving cubes together, I would simply parent them to en empty GameObject, and you control then this empty gameobject.

 Bye,

 Jean

Pyper

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Crossy Road type character movement
« Reply #2 on: April 15, 2017, 10:43:53 PM »
Jean,
Thank you for responding!

For the most part this method works.

However, I see another fellow has done the same thing and only uses an I Tween Move By action:


There is no audio, but you can see his control setup at 35:53

I would love to know how he gets it to 'hop' and turn using only I Tween Move By.

One thing I haven't figured out yet:
I have two animations: Idle and Hop.
Idle plays and loops by default, but I can't figure out how to trigger 'Hop' when I hit a key to move the character.
Can I upload my unity file?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Crossy Road type character movement
« Reply #3 on: April 18, 2017, 02:36:27 AM »
Hi,

- Have you tried to get in touch with the author of the video?

- why don't you hop using itween instead of an animation?
- Are you able to play animations like that already? can you idle and then trigger hop by pressing a key without all the movements and all. You need to cut down the problem in smaller pieces.

Let's work this out first, if you keep struggle, I'll have a look at your files.

Bye,

 Jean

Pyper

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Crossy Road type character movement
« Reply #4 on: April 18, 2017, 09:49:05 AM »
Quote
- Have you tried to get in touch with the author of the video?

Yes, he even has a website with playmaker tutorials:

http://www.onemonthgameschool.com/

I never got a response.

Quote
- why don't you hop using itween instead of an animation?

The answer is simple- I don't know how..! Following tutorial videos on youtube, I assumed I needed to create animations for both idle and hop, and trigger the hop animation when I moved the character. That isn't working. I would love a simpler solution! My character is moving, but not hoping.

Quote
- Are you able to play animations like that already? can you idle and then trigger hop by pressing a key without all the movements and all. You need to cut down the problem in smaller pieces.

I have not gotten that to work. Idle works by default (and is looping), but the hop animation never triggers. I don't know why.

Here is a video of my little guy (I modeled the crossy road chicken in MAX, but it won't be what my character is):

http://www.trinitifx.com/wip/Playmaker_Character_Movement_Test.MP4

Sorry, I know this is probably super easy..! Total newbie here..


Pyper

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Crossy Road type character movement
« Reply #5 on: April 19, 2017, 12:09:20 AM »
Quote
- why don't you hop using itween instead of an animation?

How do you 'hop' using itween? I can see how you move forward, but not forward and up/down (hop) at the same time..

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Crossy Road type character movement
« Reply #6 on: April 19, 2017, 02:32:31 AM »
Hi,

 one way to hop and move is to have two GameObjects, one that is a dummy and will always stay on the ground and you parent your player to this dummy, and you hop the player, but not the dummy, this way you can achieve complex combined programmatic animations very easily.

so you move around the dummy and when hoping you control the player.

 Bye,

 Jean