Thx
Turning card effect?
Started by MonDieu, Apr 18 2012 07:07 PM
2 replies to this topic
#1
Posted 18 April 2012 - 07:07 PM
I´ve made a memory match game and think a "turning card" effect would be nice.. anyone done this before? would appreciate some tips to start me off.
Thx
Thx
#2
Posted 18 April 2012 - 07:22 PM
something like this!..
create
front=spr_card_01 //u can leave this out and change in step same value
turn=0
mouse left
if turn=3
exit
else
turn=1
step
if turn=1
{if image_xscale=0
{turn=2
sprite_index=front}
else
image_xscale-=0.1}
else
if turn=2
{if image_xscale=1
turn=3
else
image_xscale+=0.1}
create
front=spr_card_01 //u can leave this out and change in step same value
turn=0
mouse left
if turn=3
exit
else
turn=1
step
if turn=1
{if image_xscale=0
{turn=2
sprite_index=front}
else
image_xscale-=0.1}
else
if turn=2
{if image_xscale=1
turn=3
else
image_xscale+=0.1}
#3
Posted 18 April 2012 - 07:37 PM
It's really simple, actually. You just need to mess with image_xscale or image_yscale. In the Create Event:
In the Step event:
This code will make the card turn forever, but I hope from here you can take over and adapt it to your needs.
image_speed = 0 //Stops your sprite from scrolling through subimages automatically time = 0
In the Step event:
image_xscale = cos(degtorad(time)) //In case you don't know, the cosine function returns a number from -1 to 1. Look it up for more info, it's very very useful- //Resets the counter so that it doesn't get to very high numbers if time >= 360 time -= 360 else time += 2 //Change this number for different turning speeds. Make it negative for it to go the other way. //Changes the sprite's subimage so it will show the two "faces" of the card if image_xscale < 0 image_index = 1 else image_index = 0
This code will make the card turn forever, but I hope from here you can take over and adapt it to your needs.
Edited by PetzI, 18 April 2012 - 07:39 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











