Suggestion: Pick instance by variable value

0 favourites
  • 7 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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.

  • It's already on his TODO list

  • 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.

  • 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.

    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.

  • Yeah, C2 already has this capability with compare instance variable.

  • Thndr

    Indeed it does. <img src="smileys/smiley3.gif" border="0" align="middle" /> 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. <img src="smileys/smiley10.gif" border="0" align="middle" />

    Thank you all for your answers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)