What is the meaning of constrain attribute and how to use it?

Any tutorials on what is constrain attribute and how can i apply it in my game?

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2015

    A constrain is as it say. It constrains one set of data to another. So if I create a game level attribute that will store the value of say a specific actors X position on the screen, at all times,I can share that info with other actor's code, I would constrain the actor's position X, I want to track, to that game level attribute using a constrain. A constrain will constantly mirror the value.

    So

    I create a game level real attribute and call it main_actor_X

    Constrain attribute main_actor_X to self.main_actor.position X

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2015

    Constrain = Change this attribute on every code / draw cycle, so if your game is running efficiently at 60fps, constrain is loosely equal to an every 0.0166 seconds Timer containing one change attribute behaviour.

    Hope that makes sense.

Sign In or Register to comment.