Hi there

I am making a rugby game in Flash 8 and am trying to get to grips with AS2
and OOP structuring of the code.

The game will include a wind element i.e a wind speed and a wind direction
(angle)

I have the following elements in the game that will be affected by the wind
properties:

Scoreboard (this includes a text element with the wind speed and a graphic
showing the direction)

Clouds (the cloud movement should be influenced by the wind speed and
direction)

Hot Air Balloon (the balloon movement should be influenced by the wind speed
and direction)

The rugby ball (the movement of the ball will be affected by the wind speed
and direction)

I was thinking I could create a weather manager object that contains
properties for the wind speed and direction and changes these values
randomly over time.

I would then create a separate object for each of the elements detailed
above.

If I take this approach, I am not sure how best to link the weather
conditions to these objects.

For example, the balloon is animating continually so would need to know the
current wind speed and direction say every 1/10 of a second.

Therefore would I need to get my balloon object, query the current weather
conditions every 1/10 second?

Or would it be better to have the balloon object to have its own wind speed
and wind direction property which is updated only when the weather manager
makes a change to the wind speed and direction?

I guess it would be a similar situation for all the other weather influenced
objects hence they would all have properties for wind speed and wind
direction - does this sounds a good approach?

If the weather manager is responsible for updating the wind speed and
direction properties of all these objects, do I first need to create these
objects then pass a reference to them to the weather manager when I create
the weather manager? Or is there a way to broadcast a change in the weather
conditions that all objects can receive?

With regards the weather manager changing the weather conditions
periodically, would it be better for it to have some sort of internal timer
that decides when a change is made or have my main game manager have a timer
that calls changes to the weather conditions?

I am new to this OOP approach so would like to start off on the right
footing and would appreciate advice from those in the know.

Many thanks

Paul






_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to