playMaker

Author Topic: Simple movement on one axis - how?[SOLVED]  (Read 1924 times)

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • check out my portfolio :)
Simple movement on one axis - how?[SOLVED]
« on: October 02, 2013, 01:42:56 PM »
Hi everyone,

I just recently started using PlayMaker after doing a lot with Unreal Kismet so it's completely foreign to me.

Now, I'd like to control a cube on screen, just simple movement from left to right and right to left. The player presses 'A' the cube moves left, the player presses 'd' the cube moves right. When the player releases the key the cube stops in its current position.

Using 'AddForce' I managed to make the cube jump in a direction once or (when 'Every Frame' is ticked) just continue endlessly. However, I'm kind of stuck with the rest. I can't seem to get the key release to work properly.

I use 'Get Key Down' to register the input, go to a new state that tells the cube to move but in order to register more keys, I go the previous state using 'Finished' - which is when the cube stops moving whether I have released the key or not...

Any help would be appreciated!
Thanks a lot!  :)
« Last Edit: October 03, 2013, 02:10:34 AM by jeanfabre »

intrikit

  • Full Member
  • ***
  • Posts: 132
    • Defiant Child
Re: Simple movement on one axis - how?
« Reply #1 on: October 02, 2013, 01:48:46 PM »
you can use a "Get Button Up" action to send an event to transition you back to your idle state.

nelsonn

  • Playmaker Newbie
  • *
  • Posts: 31
    • check out my portfolio :)
Re: Simple movement on one axis - how?
« Reply #2 on: October 02, 2013, 03:19:38 PM »
Thanks for the reply :)

Returning to the idle state wasn't the problem. That worked fine, actually.
The cube just wouldn't keep moving when I held the key. I found a way to solve it, though: I simply set the velocity of the cube to either -3 (move left) or 3 (move right) or reset it to 0 to stop it.

EDIT: Never mind, I found the solution to my collision problem xD
« Last Edit: October 02, 2013, 03:29:53 PM by nelsonn »