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

Get help using Construct 2

Post » Sat Oct 29, 2016 8:52 pm

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
Last edited by sizcoz on Sat Oct 29, 2016 10:35 pm, edited 1 time in total.
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352

Post » Sat Oct 29, 2016 9:30 pm

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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat Oct 29, 2016 10:07 pm

randomly wrote: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 .....!
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352

Post » Sat Oct 29, 2016 11:11 pm

sizcoz wrote:
randomly wrote: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
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Sat Oct 29, 2016 11:42 pm

TRMG wrote:
sizcoz wrote:
randomly wrote: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
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352

Post » Sun Oct 30, 2016 12:57 am

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


I didn't receive any pms...
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Sun Oct 30, 2016 9:17 am

TRMG wrote:
sizcoz wrote:hmm, have a look at the capx, i wil send it to you, pm


I didn't receive any pms...



Resent.
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352

Post » Sun Oct 30, 2016 9:43 am

sizcoz wrote:
TRMG wrote:
sizcoz wrote: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)
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Sun Oct 30, 2016 12:02 pm

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
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352


Return to How do I....?

Who is online

Users browsing this forum: beohs, boybacteria and 31 guests