Count object

This forum is currently in read-only mode.
  • Hi there

    I'm new to Construct been using Fusion for some months.

    Is there a event that counts items ?

    I'm destroying items one by one and when they are all gone i want something to happen.

    Also, does Construct or will sometime be able to export games to flash or java so it can be uploaded to the internet or phones ?

    Regards

    Sigurgeir

  • Yes. You can use this expression:

    ObjectName.Count

    For example,

    System: Compare

    Value 1: Sprite.Count

    Comparison: Equal to

    Value 2: 0

  • Also, does Construct or will sometime be able to export games to flash or java so it can be uploaded to the internet or phones ?

    I think that's unlikely (for the time being).

  • allright.. maybe one more thing about strings or textboxes..

    I have a text in a box and say when i push a button i want something to add to the text in a new line.

    Are there any commands like newline or something ?

  • Have you tried one of the tutorials? http://www.scirra.com/tutorials

    Making an event to add text when pushing a button is very simple. I'm sure you'll get it after a tutorial. Also, Newline is in fact an expression you can use when dealing with strings. Did you try it? It's also listed in the system object expressions, which you can browse by double-clicking the system object icon at the bottom when entering an expression. You'd use it like this: "Text on first line" & Newline & "Text on second line"

  • Ye that worked out fine.

    I noticed that there are alot of links on that tutorial site that dont work. Like the example files.

    http://www.scirra.com/tutorials/examples/bustaball.cap

    http://www.scirra.com/files/bumpmapping.cap

    and the platform links also.

  • Argh, our host has disabled hosting of .cap files for no apparent reason. Uhhh... I'll get on that.

  • Thanks for the heads up, those links should be working now.

  • Allright, thanks.. gonna check it out

  • Maybe one more thing.

    Can i count items that are in a familie.

    I cant use Family.Count because then it only counts the family giving me 1 but there are 3 items in the family.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Family.Count should correctly be counting all objects in the family. Post a .cap showing what you mean.

  • Maybe one more thing.

    Can i count items that are in a familie.

    I cant use Family.Count because then it only counts the family giving me 1 but there are 3 items in the family.

    Family Count, counts instances of objects made on a layout.

    so say had a sprite with a blue family and another sprite with a blue family added to them.

    So if you had 2 object of the blue family there on a layout it will say "2".

    If you want to count Families like blue, red, and green families would give you a count of 3 then, no you can't do that.

  • Are you saying you want to count how many families an object has in the events? Why do you need to do that? I can't imagine any reason.

  • No i want to count how many items are in a family. I have 3 items on the layout, they are all in the Items family. When i count them i with Items.Count i get 1.

    You can see how it works in this cap.

    http://www.internet.is/eski/testing-hide.cap

  • No i want to count how many items are in a family. I have 3 items on the layout, they are all in the Items family. When i count them i with Items.Count i get 1.

    You can see how it works in this cap.

    http://www.internet.is/eski/testing-hide.cap

    like I sad family count count the instances of objects so each one of your objects only have 1 instance so the count would be 1.

    So if you want to count all object as a private variable to the family call it count

    then add all the objects counts to it.

    I see what you want it to do. Maybe the Dev will add a "get number of all objects" that add up all the objects instances connected to the family in the next build.

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