how to say "all objects of type X"

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • If you say want 9 tiles in your game, you simply import the sprite for 1 tile, then clone it 8 times to make your grid.

    However, if you want to do something like "Mouse->Cursor is over" you have to pick one of your 9 tiles - is there any way to say "any tile object"?

    I could only add 1 in the designer, and spawn the other 8 in the event sheet, but this is a pain as I cant use the layout editor.

  • I think Ive found the answer - you cut and paste it, rather than clone. So easy when you know how!

    Construct 2 is Amazing.

  • Ok, thats not the answer - you cant address an individual instance then. I guess ill just have to have 9xCursor is Overs etc.

  • However, if you want to do something like "Mouse->Cursor is over" you have to pick one of your 9 tiles - is there any way to say "any tile object"?

    If you put all your tile objects in a family called Tiles, then you can do "Mouse: Cursor is over Tiles".

    Or if you have 9 copies of one tile object, you could give them an instance variable called 'id' and set it to 1,2,3,4, etc. Then to pick a specific tile you can use 'tile: id = 3'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should still be able to address individual instances when using 9 instances (copy+paste or ctrl+drag instead of clone). What did you try? There's probably a way to fix it.

  • Indeed, it is possible to pick specific instances of an object type.

    Check the how do I FAQ in the section "Picking/selecting instance(s)", there are already many elements listed with full discussions and examples on the subject as this is quite an important part of C2's basics.

    You can also check the tutorials (for example this one or this other one which deal entirely or in part with picking).

  • Brilliant responses, and several options. In the end I went with making copies, rather than clones, and giving each one an ID instance variable as suggested, then using several for each loops. Ill try the UID option when get I more time.

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