How do I check instance Y position

0 favourites
  • 13 posts
  • I've a sprite with 16 frames and I distributed 16 instances of this sprite in 4 x 4 (rows / columns). The player will swap them around and I need to verify that the instances with 0/1/2/3 frames are in the first row, 4/5/6/7 are in the second line, etc, ie, in a vertical position (Y). Could anyone give me some help on how to solve this? Thanks in advance.

  • Compare animation frames and set their position using loop index. To arrange them in grid fashion, you must also set the horizontal position not just the vertical.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I show you how to do it on this capx below

  • alextro

    First of all, thank you very much for trying to help me. I appreciated the example that you did, but unfortunately it is different than what I need or I did not understand your suggestion. Maybe it's my fault for having explained wrong (language barriers). I am attaching an example of my project. Note that the sprites are distributed across the screen, according to the already pre determined location. The player can click on two sprites to swap them. When sprites with the first four frames (0/3/1/2 - need not be in order) are in the first line, the next four frames (5/7/6/4 or another combination of this frames) are in the second line, and so on, the player wins.

  • Ah I'm starting to understand what actually you want to achieve. a line group of 4 should be arrange with their own "class mates" to make a match.

    I'll try to solve this puzzle mechanism later.

  • Thanks, I'll be grateful

  • One question, do the sprite need to be swapped only to their adjacent neighbor like common match 3 puzzle or they can be swapped other freely?

  • Hi The sprite can be spawned freely as I did in the example.

  • alextro

    I'm starting to think the way I used is more complicated. I thought it would be more practical to work with a single sprite and several frames instead of multiple sprites in a family. Although the distribution of instances it's okay, to check the positions is very difficult. I say this because I see that even you are having difficulties and also because I did not receive any other help or suggestion on this topic. I'd better review everything I did, isn't?

  • Here's one way to do it: [attachment=0:1fynsaub][/attachment:1fynsaub]

  • ramones

    Very clever and simple solution. Many thanks for save my day.

  • RenatoB

    Done.. you can compare mine next to ramones demo

  • alextro

    Thank you. You redid the whole project in a very different way. It seems more professional. I will study your script while compare with mine. Thanks for your time as well as the effort to help me.

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