FORUMS: list search recent posts


COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Patrick Hearn
on Dec 12, 2008 at 11:43:45 am

Oh yes, it's that time of year!

I'm having a go at doing the company christmas card. I'll just outline the idea then go into detail about how I'm approaching it and where I'm running into problems.

The company staff (4) are sat in the office with santa hats and stockings.
The camera crashes out to reveal that they are encased within a snowglobe.
Snow is falling and settling in the globe and the viewer(user?) can click and drag to 'shake' the snowglobe and get the snow moving again.


The first section is basically done and elements are being prepped for the intereactive flash bit. None of that's a huge problem.

The way I am trying to do the snowglobe bit is as follows.

I got a bit of actionscript for falling snow from
I've then built from there.

There are a few main hurdles to get over:
1. containing the snow within the globe
2. having the snow settle
3. having the snow move when 'shaken'


To contain the snow in the globe I am trying to define a circfular area using the function x^2+y^2=radius. So I look at the y position of each snowflake and check if it is outside the area thus:

//centre of the stage
//radius of the circle
if (this._x>centre){
//if the snowflake is on the right-hand side of the stage
xedge=centre+Math.sqrt(100-Math.pow(radius-this._y, 2));
//offset from centre -> x=√(radius-y^2)
if (this._x>xedge){
//if the snowflake is past this edge
//check it's on its way out
//flip direction
if (this._alpha=100){
//change opacity to differentiate between background and foreground
and the same but reversed for the other side of the stage.

This doesn't actually work though. If anyone can see a reason why that would be good.
The snow settles fine. I do this by checking if the y meeets criteria (has hit the bottom) and then removing all downward and sideways force.

Moving the snow when shaken.... well, that's tricky.

I only have an idea in my head of how this might work, if people could suggest methods I oculd use to achieve it that would be great.

When clicked and dragged a movement speed is worked out.

This speed is then applied to all snowflakes in an additive way

So if I move the globe at 1 pixel/frame down the speed will be 1 in the y.

Each snowflake will then have its y speed adjusted by -1. So now all the snowflakes will be moving, thus unsettled.

I haven't got this to work yet, but if anyone takes an interest and gets it to work I'll be very appreciative.

I'll post if I get any further with it.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved