Suggestion: Pick instance by variable value

Discussion and feedback on Construct 2

Post » Wed Jun 05, 2013 9:57 pm

I've got an idea I'd like to share and suggest to Ashley for a new event in some future C2 update - "pick instance by variable value". Let's say I've got a sprite and I assign a variable 'name' to it, or maybe assign some more variables which will hold some other instance properties (coordinates, size, Z-order, array index reference etc.) It'd be very nice if I could pick an instance by one of those custom properties, for example "pick by name 'enemy01_05'", which would be very handy. I realize this can be done with a 'for each' loop, but I think it'd be nicer to have it wrapped in a single event.
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Thu Jun 06, 2013 4:21 am

It's already on his TODO list
B
96
S
34
G
29
Posts: 3,138
Reputation: 28,234

Post » Thu Jun 06, 2013 5:29 am

Well you can't do all properties, but you can still select an object with a named variable.

Object Compare Value
or
Compare Two Values( <object.property> = <value> )

That will select the object.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Thu Jun 06, 2013 7:59 am

[QUOTE=jayderyu] Well you can't do all properties, but you can still select an object with a named variable.

Object Compare Value
or
Compare Two Values( <object.property> = <value> )

That will select the object.[/QUOTE]

Compare two values does not do any picking, says so in the tooltip even :)

And to original poster: Like said before, you can do that by comparing a single property. If you have variable name, doing 'Object compare instance variable name = Bob' would pick all objects that are named Bob.vee412013-06-06 08:02:15
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Thu Jun 06, 2013 8:14 am

Yeah, C2 already has this capability with compare instance variable.Thndr2013-06-06 08:16:15
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Thu Jun 06, 2013 8:42 am

@Thndr
Indeed it does. I've seen the event before and I know instances are picked 'automatically' when they are affected by an event, but somehow I didn't assume it was valid for that particular event as well. Don't blame me, I'm new to C2.

Thank you all for your answers.Kurajber2013-06-06 08:46:31
B
10
S
2
G
2
Posts: 29
Reputation: 1,710

Post » Wed Jul 03, 2013 10:07 am

if its not dead
https://www.dropbox.com/s/k189nhh1bxwdeu8/PickInstanceWithParameters.capx
B
6
S
3
G
1
Posts: 4
Reputation: 1,245


Return to Construct 2 General

Who is online

Users browsing this forum: mekonbekon and 6 guests