S
skeptile
Guest
I'm trying to achieve a card-flipping animation that simulates perspective, so I started off using draw_sprite_pos to skew the sprite. The result I got is this:
See how the card gets distorted in the middle? Everything kind of gets pinched up. According to the manual, this has something to do with the way sprites are drawn as a quad of primitives. Is there any way to avoid this distortion? Or is there some alternative script or function I could be using to achieve this effect more easily? I've tried a few sprite-skewing scripts from the net but I haven't been able to find something that does what I need.
Thanks for the help!
(If it helps, here's the step code for flipping the card)
See how the card gets distorted in the middle? Everything kind of gets pinched up. According to the manual, this has something to do with the way sprites are drawn as a quad of primitives. Is there any way to avoid this distortion? Or is there some alternative script or function I could be using to achieve this effect more easily? I've tried a few sprite-skewing scripts from the net but I haven't been able to find something that does what I need.
Thanks for the help!
(If it helps, here's the step code for flipping the card)
Code:
if (flipping == true) {
flipRads += (pi / room_speed);
if (flipRads >= pi) {
flipRads = 0;
flipping = false;
reset_card_corners();
}
else if (flipRads < pi / 2) {
x1 = x - sprite_xoffset + (sprite_width/2 * sin(flipRads));
x2 = x - sprite_xoffset + sprite_width - (sprite_width/2 * sin(flipRads));
x3 = x2; x4 = x1;
y1 = y - sprite_yoffset - (flipMaxY * sin(flipRads));
y2 = y - sprite_yoffset + (flipMaxY * sin(flipRads));
y3 = y - sprite_yoffset + sprite_height - (flipMaxY * sin(flipRads));
y4 = y - sprite_yoffset + sprite_height + (flipMaxY * sin(flipRads));
}
else {
if (hasFlipped == false) {
hasFlipped = true;
flipped = !flipped;
if (flipped == true)
sprite_index = spriteFront;
else sprite_index = spriteBack;
}
x1 = x - sprite_xoffset + (sprite_width/2 * sin(flipRads));
x2 = x - sprite_xoffset + sprite_width - (sprite_width/2 * sin(flipRads));
x3 = x2; x4 = x1;
y1 = y - sprite_yoffset + (flipMaxY * sin(flipRads));
y2 = y - sprite_yoffset - (flipMaxY * sin(flipRads));
y3 = y - sprite_yoffset + sprite_height + (flipMaxY * sin(flipRads));
y4 = y - sprite_yoffset + sprite_height - (flipMaxY * sin(flipRads));
}}