How do I know how many objects have been selected of type

0 favourites
  • 9 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hello,

    Is there away of knowing how many objects have been included in the sol? For example A overlaps B. How many B exist in SOL?

    I Have a character that can break blocks but I don't want him to break more than 1 at a time.

    My thought was that if he overlaps more than 1 then I select the one closest to him, otherwise I can simply destroy the one he overlaps. Similar would be if Mario jumped and hit 2 brick blocks and broke them both at the same time, which I don't want. Only one.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • +1 about this^

    I was going to suggest a feature for Construct 3 to have a tab in the debugger that displays the current SOL.

  • +1 about this^

    I was going to suggest a feature for Construct 3 to have a tab in the debugger that displays the current SOL.

    +10 for that, that would be usefull!

  • The Sprite.pickedCount expression gives that info.

  • The Sprite.pickedCount expression gives that info.

    Well twidle sticks, it would be that easy now wouldn't it

    Thanks for your help, always the champ with the answers.

  • R0J0hound thanks man!

    However, there are situations in which instances of more than one object type are picked and would be handy to have the whole SOL displayed in a table in the debugger.

    For example:

    Pick Sprite1 by evaluating Sprite1.X>250

    Pick Sprite2 by evaluating Sprite2.X>250

    If I'm not wrong, when those 2 conditions are inside the same event, C2 picks some instances of Sprite1 AND some instances of sprite2.

  • immortalx: You can have a local variable "totalpicked" which result comes from the operation: Sprite1.pickedCount + Sprite2.pickedCount

    Although perhaps the suggestion could be implemented in C3 ASHLEY.

  • Kyatric thank you a lot for the tip! I'd never thought of that myself and although it seems simple, it's ultra useful.

  • Kyatric - sometimes its funny how solutions can be so easily overlooked. Its like I'm looking for a complex answer and don't notice the simple stuff sometimes lol. Thanks.

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