How to keep an Actor moving random up,down,left and right ?

BibyBiby Member Posts: 28

Hey,
How to keep an Actor moving randomly up,down,left and right ? without getting off screen, or if it gets off screen it comes back to screen form the other side maybe ...
Any help ?

Thanks

Best Answers

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,772
    edited April 2014 Accepted Answer

    To make it wrap around the screen you need to turn on Wrap X and Wrap Y in the Scene Settings.

    Random movement could be set up like this, though there are other ways too I'm sure:

    Change Attribute moveDirection to Random (1,4)

    if moveDirection = 1 move your actor left

    if moveDirection = 2 move your actor right

    if moveDirection = 3 move your actor up

    if moveDirection = 4 move your actor down

    The above is not actual working 'code' just a guide to point you in the right direction.

    Hope it helps.

  • UtopianGamesUtopianGames Posts: 5,692
    Accepted Answer

    I helped a user a while back with something similar (last 3rd of the scene) but this can be edited for your needs.

    http://forums.gamesalad.com/discussion/66462/random-movement-within-a-3rd-of-a-scene#latest

    Darren.

Sign In or Register to comment.