SpriteText: Do you *really* have to pin it to a sprite for collisions?

From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • I'm working on a simple, visual matching game for kids, where they must must drag and drop a word (as SpriteText) over a 9-patch box correctly.

    The SpriteText obviously uses the DragDrop behavior, and it either tweens to its original position when dropped in the wrong area. However, on collision with the correct 9-patch, I want the text to lock on to the coordinates of that box.

    I have been able to achieve everything I've described above, except the Collision behavior doesn't seem to be available for SpriteText. To make it work, I've had to pin the SpriteText to an invisible Sprite.

    But, far as I can see, the SpriteText object type already has a collision box coded in by the program, and if I run Debugging, the object does actually have a collisions parameter which is set to "True."

    So am I doing this wrong, or is this literally a feature that Construct 3 has mostly implemented in the back end, but is simply turned off for some reason? It's a major time suck to edit the smaller, pinned sprite (smaller to ensure the bounding box works right) directly under a larger object on the same layer.

    Many thanks for any assistance the forum can provide.

    -Kurt

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you replace 9patch with a sprite (or add an invisible sprite to it), you can use "Sprite on collision with SpriteFont".

    Another option is to use a bunch of conditions like "Spritefont.BBoxLeft<=9patch.BBoxRight" to check if two objects overlap.

  • Thanks dop. I gave this a try and also considered whether substituting the 9-patch for the sprite would work.

    Ultimately, I decided pinning the extra target sprite would be a lot simpler, and perhaps more reliable in gameplay.

    So far, it is working pretty well.

    Thanks!

    -Kurt

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