If you know this, I'll eat my hat

Scootman,
I am almost ready to start eating my hat but need to know one more thing. I need the coin to flip like you made it do. but when it lands i want it to stop. I have tried putting a stop at the end of the action script but it carries on flipping.

here is the actionscript you supplied:

onClipEvent(load)
{
_y = 400;
scale = -15;
origY = _xscale;
grav = 0.6;
velocity = -20;
}
onClipEvent(enterFrame)
{
_yscale += scale;
if(Math.abs(_yscale) >= origY)
{
scale = -scale;
}
velocity += grav;
_y += velocity;
if(_y > 400)
{
_y = 400;
velocity = -20;
}
}

I hope this is your hat =)

Oh man, that is classic!

Senocular, thanks for answering. :slight_smile: I started somewhere around version 3/4 too, but grad school took me away from all development and I missed version 5 altogether. I just picked up MX a few months ago (when school temporarily let up), so it’s nice to know that in a few years, one can achieve great things with hard work (although I’m fairly certain there’s also a fair measure of talent in your blood). =)

Do any of you know how to stop the coin flipping?

I’m nearly there with this. So thanks

if(_y > 400)
{
_y = 400;
velocity = -20;
}
this if statement at the end is what makes it flip again… i just did that so you could see the effect over and over… just take that out if you want it to only go once… i dont know how you want it to look after its done or if you even want it on the screen at all…

here i made it so the coin stops at the bottom of the stage… to do any sort of bouncing im not sure really…that seems like it would be sort of difficult to achieve… unless maybe if you tweened that part and when the coin got to the bottom of the screen you set all the vars to 0 (like i did in this fla) and had it play the animation… i dont know, but hope this helps

(get ready to eat your hat)

u may wanna change that scale to -6 and the grav to .4 just so it flips a little slower…gives people more time to actually distinguish whats on the coin

he said it didnt matter what was on the coin

i could do it with 2 different images though… if they are the same size put them in an mc on frames 1 and 2 and each time the coin flips you switch the frames… but yeah i guess just change the velocity and rotation speed to lower to slow it down… perhaps divide it by a number each time it hits the ground or whatever… ill try and do an fla

i got the 2 different images thing… but i couldnt get the bounce to work… maybe someone else can mess with it and get it to work… (i still wanna see the hat get eaten)

(with the images its too big to attach so i uploaded it)

www.freewebs.com/scottgilmore/coin%20flip.zip

i think you have to copy/paste the url into the bar for it to work

I’m eating. Chomp, munch, chomp.

Thanks guys

lol, glad i could help