# If you know this, I'll eat my hat

**URL:** <https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622>\
**Category:** Uncategorized\
**Created:** [July 24, 2003, 8:00pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622 "2003-07-24T20:00:00Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 1:53pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/21 "2003-07-26T13:53:27Z")

</div>

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;  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 2:01pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/22 "2003-07-26T14:01:32Z")

</div>

I hope this is your hat =)  
 ![](http://andykaufman.jvlnet.com/an_two.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 2:26pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/23 "2003-07-26T14:26:34Z")

</div>

Oh man, that is classic!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 2:36pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/24 "2003-07-26T14:36:24Z")

</div>

Senocular, thanks for answering. 🙂 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). =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 2:44pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/25 "2003-07-26T14:44:48Z")

</div>

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

I’m nearly there with this. So thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 7:24pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/26 "2003-07-26T19:24:33Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 7:32pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/27 "2003-07-26T19:32:43Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 7:35pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/28 "2003-07-26T19:35:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 7:57pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/29 "2003-07-26T19:57:32Z")

</div>

he said it didnt matter what was on the coin

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 7:59pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/30 "2003-07-26T19:59:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 8:29pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/31 "2003-07-26T20:29:30Z")

</div>

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](http://www.freewebs.com/scottgilmore/coin%20flip.zip)

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 26, 2003, 11:45pm UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/32 "2003-07-26T23:45:56Z")

</div>

I’m eating. Chomp, munch, chomp.

Thanks guys

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 7:27am UTC](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622/33 "2003-07-27T07:27:03Z")

</div>

lol, glad i could help

[Previous page](https://forum.kirupa.com/t/if-you-know-this-ill-eat-my-hat/26622.md?page=1)
