Move actor to a round (integer) position after key/attributes are false?

mhedgesmhedges Raised on VCSMember Posts: 634
edited May 2016 in Working with GS (Mac)

Hello -

I have a simple query, but the response still eludes me. I have an actor which I move with a boolean (and key down as an alternative while I work on it). For example,

IF (any) RPressed = true OR key Right is down,
self.Motion.Linear Velocity X = 150

When the actor moves, it can move to any X coordinate. For the sake of example, let's say 345.11 .

My question is: How can I round that value to 345 so the actor stays at 345 the IF described above is false?

Thanks, regards.

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited May 2016

    @mhedges said:
    Hello -

    I have a simple query, but the response still eludes me. I have an actor which I move with a boolean (and key down as an alternative while I work on it). For example,

    IF (any) RPressed = true OR key Right is down,
    self.Motion.Linear Velocity X = 150

    When the actor moves, it can move to any X coordinate. For the sake of example, let's say 345.11 .

    My question is: How can I round that value to 345 so the actor stays at 345 the IF described above is false?

    Thanks, regards.

    There are functions which you can see in the expression window drop down menus called ceil and floor

    Scroll down to the function list on this page

    http://help.gamesalad.com/windows-cookbook/getting-started/11-glossary/

  • mhedgesmhedges Raised on VCS Member Posts: 634

    @KevinCross ,

    Of course! Floor worked like a charm. I was looking for "int" like a fool and couldn't find it :D . Thanks much.

Sign In or Register to comment.