GML How to make a card flip effect?

Toque

Member
Google “gamemaker card flip effect”

Its been asked and answered a few times in the past.

that would be a good start. You could try previous suggestions first.

hope that helps.
 
C

CombatCalamity

Guest
Google “gamemaker card flip effect”

Its been asked and answered a few times in the past.

that would be a good start. You could try previous suggestions first.

hope that helps.
Can you simply link the exact result that you meant here? Because I couldn't find exactly this. Surely it wouldn't be that much to ask for since it's been answered a few times in the past, right?

Also, yes, I have scoured the surface myself before doing a last resort which is to ask here.

All the results from google search first page are non gamemaker specific, and if it is, its answers vaguely direct me to learn matrix and 3D stuff which I have no interest in. I simply ask for a quick and fast way to have a flipping card effect.
 

Toque

Member
Sorry I don’t know how to code this myself.
I would try it with a sprite animation. (Because I cant code it). Make it quick. Wouldn’t be perfect though.

I might try playing with sprite animation and x_scale.

There probably a way to do it with GML.

it does seem like they play with 3D in the posts. Maybe someone can help with that............
 

Coded Games

Member
The steps for the easy way to do it:

1. Make object with card back sprite.
2. Gradually decrease image_xscale
3. When image_xscale == 0, change to card front sprite.
4. Gradually increase image_xscale back to 1.
 
C

CombatCalamity

Guest
The steps for the easy way to do it:

1. Make object with card back sprite.
2. Gradually decrease image_xscale
3. When image_xscale == 0, change to card front sprite.
4. Gradually increase image_xscale back to 1.
Sorry I don’t know how to code this myself.
I would try it with a sprite animation. (Because I cant code it). Make it quick. Wouldn’t be perfect though.

I might try playing with sprite animation and x_scale.
That's not what I want at all. It will look like this instead.
https://twitter.com/soulweavergames/status/798292630790606848

Now compare that to => https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_flip_card

Quite a difference, right?
 

GameDevDan

Former Jam Host
Moderator
GMC Elder
It's not much of a difference. It depends how difficult you want it to be to code.

Making image_xscale go from 1 to -1 and changing the sprite at 0 is the fast, easy way of doing it and it's a passable effect.

To achieve the effect in the CSS example where it turns through a 3d angle so that the card image skews slightly, you would have to do one of the following things:
  • Make your game in d3d
  • Use draw_sprite_pos and do some clever calculations
  • Draw a primitive from scratch using some clever calculations
 
C

CombatCalamity

Guest
It's not much of a difference. It depends how difficult you want it to be to code.

Making image_xscale go from 1 to -1 and changing the sprite at 0 is the fast, easy way of doing it and it's a passable effect.

To achieve the effect in the CSS example where it turns through a 3d angle so that the card image skews slightly, you would have to do one of the following things:
  • Make your game in d3d
  • Use draw_sprite_pos and do some clever calculations
  • Draw a primitive from scratch using some clever calculations
Unfortunately number 2 doesn't work that easily and it's the most viable option compared to the other 2. It has some weird behavior that stretches the sprite randomly.

Not easy to do i 2D due zo how uvs are interpolated. Youd need a dhader gor thst.
Fortunately KeeVee has one on the marketplace: https://marketplace.yoyogames.com/assets/4720/draw-sprite-pos-fixed
Ahhh crap, this is exactly what I'm looking for, thanks so much @The Reverend !!!!
 
Top