Pick everything in a certain range

0 favourites
  • 6 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hello everyone,

    I need to pick certain objects in range ValueLeft. They need to be set to different frames: black, red, and green for out-of-range, invalid, or valid respectively. However, The object needs to calculate around objects, like this:

    Note: blue/red is wall/invalid, white 'p' block is player, black is out-of-range, and green is in range.

    As you can see, LOS won't work for this to pick objects, because I need to pick these around corners.

    Any help would be appreciated.

    Tagged:

  • you could use isOverlappingAtOffset and put it in a loop so you go through each "cell"

  • Could someone work through the logic on how to do that? I am having trouble getting it right.

  • here I'm checking in square grid around the player's nearest owned territory. The size of the grid can change, hence the variable. It's a little complex because I use constants GRID_LEFT etc.. which is just my grid size minus itself. i.e. GRIDSIZE = 32, GRID_LEFT = -32, GRID_RIGHT = 64 etc....

  • Just to make your code a little clearer, what size is the system_select object? Where is it located?

    Thank you for your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the system_select object is the exact size of the grid. So this is when the selection is on a particular grid piece, it then checks all the other grid pieces adjacent, so 3x3 around a center piece. Then if the range is 2, it goes out "1 further" 5x5 etc...

    so in your case I think you just want to test every grid piece in your layout. But this is how I use isOverlappingAtOffset.

    It's used like an IF CONDITION. "If it were here, would it be overlapping object X?" is the logic behind it.

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