How do I use image point name in expressions? [solved]

0 favourites
  • 5 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm trying to loop through a sprites image-points,create objects and set:

    SpawnedPart.AnimationName = Sprite.ImagePointName(loopindex("Parts"))

    This is meant to be executed between plenty of objects so I thougt this would be a failsafe way to approach it to avoid ImagePoints being in wrong order, rather than making references to numbers which could be more vulnurable to human error.

  • If you have image points with names like "Point1", "Point2", "Point3", then you can access them using expressions like these:

    Sprite.ImagePointX("Point" & number)

    or

    Sprite.ImagePointX("Point" & loopindex("Parts"))

  • Thanx for advice.

    I could make a dictionary or an array, or just a comment on what part should go where.

    But I really hoped there was a way to extract the name from a given image point.

    The plan was:

    Sprite Player with imagepoints for:

    ArmL1, ArmL2, BodyU, BodyD etc.

    Sprite Parts with animations named:

    ArmL1, ArmL2, BodyU, BodyD etc.

    Have Player Spawn Parts and set the animation name to match every image point name.

    Perhaps I'm overcomplicating things...

  • Have Player Spawn Parts and set the animation name to match every image point name.

    You can do the other way around - spawn parts with every animation and attach them to image point with the same name as the animation.

    I don't think it's possible to get image point name by its index.

    And of course you can spawn an entire creature with all body parts using hierarchies and templates.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can do the other way around

    Of course! Now I feel silly. LOL

    I've been using hierarchies for some predefined setups but wanted to experiment with dynamic setups that can be built upon and expanded, templates would work nicely towards that but apparently I decided to wander into a dark alley instead. :-D

    Thanx!

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