iterate through all instances

This forum is currently in read-only mode.
  • How do I iterate through all instances of an Object

    if I do

    Meteor.X += 1

    only one of my Meteors moves.

    And as someone mentioned in another post. Picking support in python. Do something with all picked objects or... pick and unpick objects.

  • System: For Each Object

    But just in case you don't need to, might I suggest you post a description of the type of movement you want for your meteors? You might not need to do a loop at all. Depending on what you want them to do there could be an alternate method.

  • Thanks for trying to help me out.

    The quetion is not so much on the actual movement but on how to access individual object instances and all object instances. In Python that is.

    I am able to find a For each Sprite in python.

    It would have been natural for the python part to be able to iterate over all Sprites using something in the lines of

    for instance in Sprite
        instance.X += 1
    [/code:38rp9999]
    
    or something like
    [code:38rp9999]Sprite[index] += 1[/code:38rp9999]
    
    Another option would be to use the event picking mechanism and execute the python script as part of the action. Would that be possible. I think it would be a nice option to have the python script as an action of some event.
  • Davo, what's the syntax for this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I believe it was

    for instance in Sprite

    instance.X += 1;

    I implemented the elements thing in the classes so object types were iterable, but I cant remember if the above is the syntax, I'll check when I get home and hopefully get back to you

  • for instance in Sprite

    instance.X += 1;

    Looks natural. But I cant get it to work. I hope that im doing something wrong

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