Multi-Resolution Game Development With GameBuilder Studio Check it out!
NEW Version 0.9.7 has arrived! New Blazing Fast Particle Engine & More Game Actions. Check it out
Setting Y coordinate limits of character
  • In reference to the Hungry Hero tutorials where the Hero has ' is Sensor ' checked to On, 
    How would one create a ground boundary so the Hero wont go below a certain Y coordinate, below the screen? 
    I tried overlaying a 'dummy' object stretched over the ground, set as Kinematic, had 'Is Sensor' on or off and had set the collision detection to ground which I added as a type in the Settings/Engine types.

    Maybe this is not possible because Hero has 'Is Sensor' checked for the rest of the game to work?
  • 2 Comments sorted by
  • Hi @BenFromOregon If you want to constrain a value between a minimum and a maximum just use a math method called clampToRange( currentN, minN, maxN )  inside of an expression. Feed in the current Y value of the object then set the minimum to maybe 100 pixels from the top of the screen then set the maximum to 100 pixels from the bottom of the screen. 

    You can make the bottom from screen value dynamic by reading the current screen height from the expression property

    Game.Screen.height

    IsSensor just turns an object into an invisible object to the rest of the physics world in your game preventing any physical simulation but still allows the entity to receive collision notifications if another object collides with it. 

    Hope this helps! :)
  • Great, Thank You. This will help others learning also!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tagged