0 Favourites

How do I z-order css,button (card game example included)

  • Ok

    Been thinking about a card game, I have sorted out how to flip the cards with css, but when I flip them the z-order needs to be reversed?, i will provide a capx, If anyone can seriously help?

    look at where I am at, you can pick any card, and they turn over, but then they keep thier z order (which is not what I want), so have a look and see if you can come up with a solution?

    Example here :http://www.sizzle-games.com/card2/

    So to recap, I want the picked card to be on top

    Probably only works in chrome at present

    Many thanks

  • I'd appreciate a capx, yes.

    I don't know how you perform the flipping atm, but I'd just simply lerp (or qerp, whatever you prefer) the width to zero, spawn a new Sprite with the appropriate card face and width 0, destroy the cardback and then lerp back to the initial width.

    You could simply put that card on top of the z-order at any point of the lerps.

  • I'd appreciate a capx, yes.

    I don't know how you perform the flipping atm, but I'd just simply lerp (or qerp, whatever you prefer) the width to zero, spawn a new Sprite with the appropriate card face and width 0, destroy the cardback and then lerp back to the initial width.

    You could simply put that card on top of the z-order at any point of the lerps.

    capx sent

    Hope, it makes sense?, Z-order construct does not apply here .....!

  • > I'd appreciate a capx, yes.

    >

    > I don't know how you perform the flipping atm, but I'd just simply lerp (or qerp, whatever you prefer) the width to zero, spawn a new Sprite with the appropriate card face and width 0, destroy the cardback and then lerp back to the initial width.

    >

    > You could simply put that card on top of the z-order at any point of the lerps.

    >

    capx sent

    Hope, it makes sense?, Z-order construct does not apply here .....!

    Try when you click on the card to set it's z order to top of layer/in front of the other cards:

    (Ex code) On left clicked on object "card" -> card - z order - move to top

  • >

    > > I'd appreciate a capx, yes.

    > >

    > > I don't know how you perform the flipping atm, but I'd just simply lerp (or qerp, whatever you prefer) the width to zero, spawn a new Sprite with the appropriate card face and width 0, destroy the cardback and then lerp back to the initial width.

    > >

    > > You could simply put that card on top of the z-order at any point of the lerps.

    > >

    >

    > capx sent

    >

    > Hope, it makes sense?, Z-order construct does not apply here .....!

    >

    Try when you click on the card to set it's z order to top of layer/in front of the other cards:

    (Ex code) On left clicked on object "card" -> card - z order - move to top

    hmm, have a look at the capx, i wil send it to you, pm

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • hmm, have a look at the capx, i wil send it to you, pm

    I didn't receive any pms...

  • >

    > hmm, have a look at the capx, i wil send it to you, pm

    >

    I didn't receive any pms...

    Resent.

  • >

    > >

    > > hmm, have a look at the capx, i wil send it to you, pm

    > >

    >

    > I didn't receive any pms...

    >

    Resent.

    Hey,

    I took a look at it and I think the problem is that the buttons don't have any z-order actions...

    If you could replace the button objects with sprites then you could rearrange the z-order, but I don't know if your CSS code will work with sprites.(I never used CSS in C2)

  • [quote:1dg5dc8p]

    Hey,

    I took a look at it and I think the problem is that the buttons don't have any z-order actions...

    If you could replace the button objects with sprites then you could rearrange the z-order, but I don't know if your CSS code will work with sprites.(I never used CSS in C2)

    Thanks for your reply,

    I can use Sprites, but that's a load of animations to do that, to achieve the same effect, that's achieved with one picture file only.

    In css the browser does all the work, so its fast, normally even on mobile.

    Form controls sit on top of the canvas, so the only way to z order is through css, but I cant work out how to implement this into construct2's expressions, in css there is a z-order command, but I cant get it working, maybe I need to attach a .css project file with javascipt?.

    Hope someone can give some guidance?

    Cheers

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