Choosing random sprites

  • I have an event sheet that creates a sprite:

    System > Every SecondsPerObject seconds > System > Create object ObjectBox01 on layer "OBJECTS" at (280,75)

    But what would I write if I wanted to choose from a random selection of sprites? eg ObjectBox01, ObjectBox02, ObjectBox03

    Thanks all.

  • You can use System > Create Object(by Name)

    Then put in Object Name: choose("Obj01","Obj02,"Obj03")

  • You can use System > Create Object(by Name)

    Then put in Object Name: choose("Obj01","Obj02,"Obj03")

    Uuh, I didn't knew 'choose' could be used like that. I thought it was just with numbers. Neat. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use System > Create Object(by Name)

    Then put in Object Name: choose("Obj01","Obj02,"Obj03")

    Thats great - thanks.

    One issue thats arose from this is that I now have to duplicate every event of Object01 every time t appears in the event sheet. Eg:

    Object01 > X=300 > Object01 > Destroy

    now becomes

    Object01 > X=300 > Object01 > Destroy

    Object02 > X=300 > Object02 > Destroy

    Object03 > X=300 > Object03 > Destroy

    Object04 > X=300 > Object04 > Destroy

    Is there away to group all these separate Objects together under one label? Is this where Families comes into play?

  • You can put them in a family and set condition that

    For each famObj

    --Sub condition: famObj.X > 300 -> famObj destroy

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