Reference Individual Instance Variables

Get help using Construct 2

Post » Thu Sep 26, 2013 8:32 pm

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.

B
5
Posts: 15
Reputation: 357

Post » Thu Sep 26, 2013 9:17 pm

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.
ImageImageImage
B
71
S
22
G
257
Posts: 3,788
Reputation: 142,692

Post » Thu Sep 26, 2013 10:03 pm

[QUOTE=blackhornet] 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.[/QUOTE]

@backhornet

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?Cybearg2013-09-26 22:04:08
B
5
Posts: 15
Reputation: 357

Post » Thu Sep 26, 2013 10:35 pm

ImageImageImage
B
71
S
22
G
257
Posts: 3,788
Reputation: 142,692

Post » Fri Sep 27, 2013 5:32 am

@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?
B
5
Posts: 15
Reputation: 357

Post » Fri Sep 27, 2013 7:30 am

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.
ImageImageImage
B
71
S
22
G
257
Posts: 3,788
Reputation: 142,692


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests