Problem picking objects

For questions about using Classic.

Post » Thu Jan 13, 2011 6:27 pm

Hi everyone!

I'm pretty new to construct. And I'm completely new to the board. I've been experimenting with construct a lot and have been amazed by the possibilities it offers.

I get along pretty okay with the event sheets since it's just another way to write scripts.
But the concept of picking certain instances from an object is pretty new to me so I've ran into a problem.

I need to know how to pass on picked objects to other conditions. Let me explain what im trying to do:

EVENT: Sprite.Value('Type') = "Wood"
---SUBEVENT: Fire is Overlapping with Sprite ACTION: Set Sprite.Value('On Fire') to 1

I think it's pretty clear what I'm trying to do here: If the Sprite instance with the type string of "Wood" is overlapping with the fire object the 'On Fire' private variable is set to 1.

Instead the program just looks if there is ANY Instance with the value "Wood" is available and then applies the sub condition to all instances which overlap.

So my question is: Is there any way to reference the instances you picked before?

Thanks in advance.
mode7
B
1
G
1
Posts: 2
Reputation: 429

Post » Thu Jan 13, 2011 6:39 pm

[quote="mode7":3puz9cjf]
EVENT: Sprite.Value('Type') = "Wood"
---SUBEVENT: Fire is Overlapping with Sprite ACTION: Set Sprite.Value('On Fire') to 1[/quote:3puz9cjf]

First you're picking the correct instances of your sprite. But with your subevent, you're newly picking instances of the sprite that overlap the fire object. If you switch the object order of that condition, it'll work correctly:

EVENT: Sprite.Value('Type') = "Wood"
---SUBEVENT: Sprite is Overlapping with Fire ACTION: Set Sprite.Value('On Fire') to 1

There's no need for a subevent btw, it could all be conditions of the same event.

Oh, and welcome to the community! :D
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Thu Jan 13, 2011 8:58 pm

Thanks that worked!!
I knew it was something as simple as that.

Just one more question: Is it possible to pick one instance when two instances of the same object collide
B
1
G
1
Posts: 2
Reputation: 429

Post » Thu Jan 13, 2011 10:21 pm

[quote="mode7":ktxsh2en]Thanks that worked!!
I knew it was something as simple as that.

Just one more question: Is it possible to pick one instance when two instances of the same object collide[/quote:ktxsh2en]

It is possible to do this by assigning a family or an attribute to your object.

For instance, if you have enemies that you want to bounce off of each other, you can put them in the Enemy family. Then your collision condition would look like this:

[code:ktxsh2en]
+ EnemySprite: On collision with Enemy (family)
-> EnemySprite: Do bouncing actions
[/code:ktxsh2en]

You can also do that with attributes, but it's more limited in scope.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests