Pick nearest / furthest at same time if meet conditions?

  • Hi,

    Im trying to randomized a level with that

    It working good and it create 80 cubes that player can jump on it.

    Now im trying to choose all the cubes with Y = 300 and compare the before and the next to it if the Y = 400 so i can create another cube at the middle of them a little higher.

    So if the 1 cube Y=400 , the second cube Y=300 and the 3rd cube Y=400 , create another cube up from the second cube at Y=100.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What are you trying to accomplish here? It sounds like the cubes overlap across x because they're 80 wide but can be only 10 distance from each other, but the Y you want to build a cube 200 above but the height is only 120 so there will be gaps?

  • What are you trying to accomplish here? It sounds like the cubes overlap across x because they're 80 wide but can be only 10 distance from each other, but the Y you want to build a cube 200 above but the height is only 120 so there will be gaps?

    If i spawn a cube with 80 width it only count the half of it. So, if 2 cubes with 80 width and the minimum space 150 the we have 150-40-40 and we have a space of 60.

    Any thats not my question.

  • You use the id variable you've set up, so you search for all sprites that are Y=300 and then check the Y of sprites where id is sprite.id-1 and sprite.id+1, the ones on either side. If both of those values are 400 then true and spawn the new sprite.

  • You use the id variable you've set up, so you search for all sprites that are Y=300 and then check the Y of sprites where id is sprite.id-1 and sprite.id+1, the ones on either side. If both of those values are 400 then true and spawn the new sprite.

    Sounds good, let me try it .

    Meanwhile any idea how i can bring this example to life?

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