How do I change variable names in a condition? (name clashing)

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • When creating conditions in the event sheet, is there a way to change the name of the variable that an object binds to? I want to access instance variables of two objects that collide and are of the same type. However, when I attempt to access their instance variables, I think the second variable overshadows the first. Below is a screenshot from a project sample that I'm using for inspiration.

    The sample solved this problem by using an object family. Unfortunately, I'm using the free version of Construct in an educational setting. So, students will not have access to that feature. Is there a way to change the name of either of the variables within the condition?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey man, I don't know if I got your problem right. But, what if you created an Instance Variable inside your item called something like "type". Then, when Item with variable "type" equals 1, something happen. If it equals 2, other happen, and so on.

    I do this sometimes when I need to differentiate two instances of a same Sprite. I put a Instance Variable with different values to create a difference between then in the events.

  • Without families this will be a bit tricky.

    In "Item overlapping Item" event at least two instances of Item are picked. If you use Item.variable in an expression, it will take the value from the first instance only.

    You need to use "For each Item" loop in a sub-event to iterate all instances.

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