Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

simple movement problem

mikejamesfishermikejamesfisher Posts: 48Member, BASIC

I have a left button on screen that moves the actor left... When button is pressed, attribute moveleft is changed to true. When it is not pressed, attribute move left is changed to false. The actor has a rule that states... when attribute move left is true, change attribute self linear to -180.... There is also a right and a jump button. When jump is pressed, the walking actor spawns the flying actor and destroys itself. Now... when left is held down through the destroy and spawn, the spawned actor does not continue moving left. The left button needs to be pressed again. I want to maintain the changing of the attribute. Both actors have the same move left rules. Nothing changes the moveleft attribute to false except lifting off the left button. I have tried move 180 rules already and that didn't work either. any ideas, flaws in my logic?


  • RowdyPantsRowdyPants Posts: 410Member, PRO
    edited May 3

    @mikejamesfisher Do you always want the flying actor to be moving left? If so you could take out its 'if button pressed move left' and just put in a change attribute behavior 'linear.velocity.x to -180' and separate that out from that actor's 'if button not pressed changed to false' rule. That way you could spawn the flying actor, not let go of the button, be moving left, and only stop/slow down/do something else if the button is released or something else changes.

    Edit: Didn't read close enough. You could just save your actor's linear velocity into a game level attribute and then in your flying actor set its linear.velocity.x to that saved variable so that whenever it gets created it automatically starts moving the way that the ground version was moving. I think of this as your 'runner' starts the motion and your 'flyer' ends the motion (needs to be able to react to releasing buttons). Is that close or not really the effect you're wanting?

  • mikejamesfishermikejamesfisher Posts: 48Member, BASIC

    Yes thank you thats what i want... (the actor can move both directions). i did try the attribute model but didnt work. But it should. So i wil look back over and try try try. Thank you for the suggestions!

  • RowdyPantsRowdyPants Posts: 410Member, PRO
    edited May 10

    @mikejamesfisher I made a project for you showing methods of hero movement with running, jumping, transitioning to flight, flying, and landing.

    I got a bit carried away and added various mechanics like fuel consumption, ore collection, health bar, shield, swappable color themes, parallax, volume control, pause scene, animated menus, particles, and end game conditions like victory and defeat. :lol: For simplicity, I removed a few things -- I better share this with you before I end up turning it into an entire game. Enjoy :blush:

  • mikejamesfishermikejamesfisher Posts: 48Member, BASIC

    Lol you are the man! Thank you! Mr Pants for president!

Sign In or Register to comment.