How do I set biggest value between two overlapping objects

0 favourites
  • 3 posts
From the Asset Store
Footsteps SFX Two contains 450 sounds of steps and jumps on different surfaces.
  • Hello everyone. Lately I'm trying to develop this game where the HSL of the screen changes depending on the distance the character is from certain objects.

    Like light bulbs, if the player is close to them the HSL it set to 100 and the screen get bright and colorful, if the player is far from them the screen gets gradually darker and in black and white.

    The problem here is, sometimes the player is really close to one of those light bulbs but the screen gets too dark because he is really far away from another one.

    Is there any way I can determine which of the actives light bulbs will have the higher HSL before setting it?

    I tried to set only the higher HSL but then after the HSL reaches 100 it never goes down again so I'm kind of lost.

    Thank you guys for the assistance o/

  • i have used opacity in example... capx> http://s000.tinyupload.com/index.php?fi ... 5810331358

    If this did not help,please upload capx...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Dude! This helped A LOT!

    A didn't knew about the function get nearest, this completely solved the problem. Thank you very much.

    Also, I didn't knew about the function distance, I was calculating the distance mathematically you know?

    sqrt( (player.x - bulb.x)^2 + (player.y - bulb.y)^2 )

    You not only solved my problem but you also helped me to clean my code and make it simpler.

    Thank you, thank you very much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)