Legacy GM [SOLVED] Animating a card flipping

M

Matt93

Guest
Hey everyone,

I'm making a Solitaire game at the moment, and am trying to add in some smooth animations. If possible, I'd like the card which you select from the deck to be animated flipping over as it's revealed. Something similar to this:

I can't even think how I would do this, or whether I should aim to do this with code, or use a program (if so, which?) which could make the animation frames for me. Any advice would be great.

Cheers!
 

obscene

Member
d3d_transform_set_rotation_y(some_value_here); // Gradually change this from 0 to 180 and you might get the effect you want
d3d_transform_add_translation(x,y,0);
draw_self();
d3d_transform_set_identity();

If you don't care about the perspective you can simply manipulate image_xscale to flip things in a flat 2D way.
 
M

Matt93

Guest
d3d_transform_set_rotation_y(some_value_here); // Gradually change this from 0 to 180 and you might get the effect you want
d3d_transform_add_translation(x,y,0);
draw_self();
d3d_transform_set_identity();

If you don't care about the perspective you can simply manipulate image_xscale to flip things in a flat 2D way.
Thank you! I had no idea about these functions. Just to check, would I need to use all those d3d_ functions you just listed? And would I need to adapt those translation values where you've written d3d_transform_add_translation(x,y,0)? I'm going to experiment with this tomorrow anyway.
 
M

Matt93

Guest
I got it working using the d3d functions! Here's my code:

Draw event:
Code:
d3d_transform_set_rotation_y(val);
d3d_transform_add_translation(x,y,0);
draw_sprite(sprite_index,image_index,0,0);
d3d_transform_set_identity();
Then just increasing val in the step event until it reaches 180. Thank you for the help, marking as solved.
 
M

mfd_famous

Guest
So it seems these functions are not available by default in GMS2? Does anybody know how I could use these functions for an otherwise 2D card game in GMS2?
 
Top