Reference Individual Instance Variables

0 favourites
  • 6 posts
From the Asset Store
Color Variable
$4.50 USD
10% off
Easily store, modify, read and manipulate colors with Color Variables!
  • I'm working on a Tapper clone. Currently, I have patrons that spawn at the start of the game and start moving to the right. The player moves up and down based on an array for the location. The bar counters likewise use an array to denote the start and end of the counters, so the mugs know when to fall.

    I want to set an index for each spawned customer based on... something. At first, I was going to determine their appropriate index by checking them against the y values of the player's movement array, but that didn't seem to work. Now instead, I'm trying to set each customer's array based on them colliding with a SpawnPt object (an invisible object that they are spawned from), but it doesn't seem to work. So far as I can tell, they all act as though their custIndex = 0 (based on the location they are destroyed at when moving to the left), even though it should be set differently for each. Any idea of what is wrong?

    For reference, c100 is a customer type under the Customers family. custIndex is an instance variable set for the Customers family.

    <img src="http://i41.tinypic.com/f4jm8x.png" border="0" />

  • You don't need to do the overlapping bit. You know which SpawnPt you are creating your object at, so just set your custIndex right after each create.

    SpawnPt.Spawn_another_object would actually be slightly simpler.

  • You don't need to do the overlapping bit. You know which SpawnPt you are creating your object at, so just set your custIndex right after each create.

    How would I do that? That's kind of the question I've got: how do I make modifications to a newly-spawned instance of an object?

  • Try Construct 3

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

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

    Perfect, thank you! So apparently Construct 2 "remembers" a certain instance once it has been created for a while and any new commands will affect the most recent instance?

  • Yes. Please read the manual page: Object Types

    It's critical that you understand the picked-object concept when working with C2. Once that's clear, life becomes much easier.

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