Is this a bug or am I missing something?

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi,

    Construct newbie here, only been using it about 3-4 weeks. I've been working on a card game, basically a Hearthstone clone with spaceships, and it's coming along quite nicely now, except I've come across something a bit strange recently.

    I have an event that shows a larger version of any card when the cursor hovers over a card sprite

    However, it seems that when this event triggers, it affects the pinning of some text objects attached to other card sprites. Normally this wouldn't be an issue as the cards don't move around much, but while cards are ready to attack they are set to a sine movement on the Z elevation. So while this event is active the text object seems to be going in and out of visibility, almost as if they're going behind the sprite. Then when the event ends, the text stays either visible or not depending on the point that the event ends.

    Having tried disabling different parts of the event to see what might be causing it, it seems to be when I choose to pick the top instance of the Deck sprite (the sprite used for both cards in hand and active), but I can't see why picking the top instance out of one group of sprites, would affect the pinning (at least I think it's the pinning that it's affecting) of a text object to another instance of the same sprite? It also seems to only happen when the cursor is over multiple sprites.

    If anyone has any thoughts it would be greatly appreciated, thanks!

    Here's my full project file as well

  • It's too difficult to get to a point where you can reproduce the bug, better it is set up to show the bug.

  • Ah yes, fair enough. Sorry, I didn't think about that, I'll see if I can set up an example version like that, thanks.

    I have managed to get around this in the meantime, by using a separate sprite, pinned to the sprite that's moving, to pin the text to, that way the bit under the text isn't moving. But, I'd still be curious to know if this issue was caused by something I was doing or not.

  • OK, here's another version where it'll load straight to a point of being able to see the bug. If you load it in debug (I've removed all the multiplayer stuff for now) all you have to do is drag drop one of the cards at the bottom of the screen to the middle, so it becomes active, it should then start "hovering" with the sine movement, then if you move the cursor over the other cards at the bottom of the screen, you'll see the text on the active card start to appear and disappear.

  • The quick fix should be to move the stat objects onto their own layer or ensure they are always at the top of Z by moving to top of layer every tick. The issue is because the sin Z swapping will affect the whole card and anything pinned to it. If you select the stat object after you play the card you'll see its Z index is constantly changing.

  • Thanks , I did try something like this, moving onto their own layer I think, but I then had an issue around the cards still in the hand, as it meant all the stats were on top there too.

    I guess I could maybe write a condition that said to move to top of layer once the card it's pinned to is active, but it just seems strange that it works fine like this, until I trigger the event when hovering over the cards. Ideally I do want the stat to be moving up and down with the card, as it just makes it look more like it's one thing. But if it just doesn't work, then I'm happy with the solution I have now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you give the stat object the same behaviour it should move up and down in sync with the card below. There are probably lots of ways to do it. I didn't investigate enough to see exactly what would work. You could also try moving active cards onto their own layer that might give more control.

  • Thanks! Some good ideas I hadn't thought of there, I'll give them a go

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