How do I use a unique touch event for multiple instances of the same object?

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey I have a really simple question:

    I have multiple instances of the same object as you can see below:

    I want to be able to do specific things with each one when a user touches one.

    I am using the following events:

    But nothing happens...

    What is it I'm doing wrong?

  • You want to have an instance variable on each instance that ddetermines what happens when you interact with it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You want to have an instance variable on each instance that ddetermines what happens when you interact with it.

    Hey, I'm afraid this isn't an option, as each card is created via events, I'm making a card game, I just want a generic event so when the user taps one of the cards it flips,

    if I use instance variables this would be very tedious as I would have to repeat my code for each object i.e

    if touched card and ID = 1

    play animation

    if I had to do this for 100 cards this wouldn't be very ergonomic.

    Do you know why my previous event with the for each doesn't work?

  • Your title said unique touch event for instances, so you would need a unique identifier for each instance to determine what unique event to run. You can set an instance variable when creating objects via events as well no problem.

    If you want a generic event for flipping the card, then a simple on touched object would suffice - only the touched instance would be picked, and only that instance would flip.

    I don't know why your previous event with for each doesn't work, as I have no idea why you would want to use for each in this situation to begin with, since for each doesn't really have anything to do with what I understand your question to be.

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