How do I make it to where if variable equals to a variable..

0 favourites
  • 4 posts
From the Asset Store
More, less or equal
$15.30 USD
15% off
The game will give you a dog that appeared and you must say if he appeared more, less or equal.
  • Basically in Construct 2 how do I do

    A1:

    if (how_many_pizzas_I_have == my_hp) //if variable how_many_pizzas_I_have is equal to my_hp
    {
     x += 5; //go right by five pixels;
    }
    [/code:21yfj77u]
    
    B1:
    [code:21yfj77u]
    if (instance_exists(100012)) //if in room an instance of an object with id 100012 does exist
    {
      if (instance_exists(100711)) //if in room an instance of an object with id 100711 does exist
      {
        if ((100711).hp == (100012).my_money)) //if instance of an object that has id of 100711 has variable hp that is equal to variable my_money of instance of an object that has id of 100012
        {
            (100711).y -= 17; //instance of an object with id of 100711 goes down by 17 pixels
        }
      }
    }
    [/code:21yfj77u]
    
    Also regarding Construct 2 if someone buys Construct 2 from Steam does Construct 2 bought from Steam come with absolutely (unrestrictedly) all exporting possibilities as Construct 2 bought elsewhere?
  • It's system > compare Global/Local variable or object > compare Instance Variable depending on which it is. System compare TotalPizza = PlayerHP > do action.

  • Code A1.

    Add a global variable 'how_many_pizzas_I_have' (number) to the events sheet.

    Add a global variable 'my_hp' (number) to the events sheet.

    Add a new new event to the sheet.

    Click the object that you want to move and choose a condition that picks that object.

    Add Another conditions to the same event.

    System > Compare two values ... First value = 'how_many_pizzas_I_have' .. = Equal to .. Second value = 'my_hp'

    Add an action to that event > Click the object that you gonna move > choose Set X .... X = self.x + 5

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Code B1

    Add a Family. Add 'object' to the family.

    Add an instance variable 'id' to the family.

    Add an instance variable 'hp' to the family

    Add an instance variable 'my_money' to the family

    Get some code in place that gives numbers to 'id'.

    Add an event.

    Object > Is on Screen

    Family > is on screen

    Object > Compare instance variable > Id = 100012

    Family > Compare instance variable > Id = 100711

    System > Compare two values ... First value = object.hp = Equal to .. Second value = Family.my_money

    Add an action to that event > Family > choose Set X .... X = self.x + 17

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