Help with constraining a character please

Hello,

I need help keeping an actor in the boundaries of the scene and I can't remember how to do it. Please help

Thanks

Comments

  • retired_830c50d3bf119e557be016b4f24844c9retired_830c50d3bf119e557be016b4f24844c9 ImagineLabs.rocks Member, PRO Posts: 5,772

    There are lots of ways.

    One way is to set up non-moveable actors at your screen edges and add a collide in your player to collide with the edge actors.

    Another would be to put a rule in your actor like this:

    If self.position.X < 0
    
    Change self.postion.X to 0
    

    That would stop the player from moving off the left edge of the screen, you'd need to add additional rules for the top, bottom, and right edges.

Sign In or Register to comment.