How do I make distance for every instance ?

  • I want to make for every list item level game that can responsive position for every mobile device screen. Can somebody help me to give reference ? Thank you for your helping guys

    It is screenshoot from my layout

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well first you need to work out the width of the screen, incase you are using unbound scrolling the top left of layout is no longer 0, so to get the screen width use viewportRight - viewportLeft.

    Now you need to get the width of all your blocks put together, so combined block width = block.width * number of blocks on a row.

    Then you need to work out how much space is left over for your gaps in-between blocks and divide that by number of blocks, so gap = (screen width - combined block width) / number of blocks on a row.

    Now to do the actual spacing, you can arrange blocks by their IIDs using the optional instance parameter block(IID).expression, so you would do - repeat number of block times, set block(loopindex).x to viewportLeft+(blockwidth*loopindex)+gap

    Same for height.

    I didn't test it so dont know if it works as intended.

  • Thank you mOOnpunk for your suggestions or idea.

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