moving actors

hi,
i have an actor that moves up, down, left and right which is controlled buy a joystick in the game. When the actor moves its usually lands up in a real number postion (eg:- postion X =217.8 postion y= 280.36 ). i want the actors to land only on a whole number (eg:- postion X =218 postion y= 280).

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    Accepted Answer

    @djdee

    Hi, the only solution to this problem, I'm thinking, is on touch release, adjust the x and y coordinates of the actor accordingly. So one way to do this is to make two integer attributes, PosX and PosY

    Then in your Rules of your joystick:

    When Touch is released
    Change attribute PosX to scene.Background.Moving Actor.Position.X
    Change attribute PosY to scene.Background.Moving Actor.Position.Y

    ---- as they are integer attributes, they'll automatically round down to the nearest whole number. You could also use the floor expression instead)

    Change attribute scene.Background.Moving Actor.Position.X to PosX
    Change attribute scene.Background.Moving Actor.Position.Y PosY

    Hope that sorts it.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

Sign In or Register to comment.