Sign in to follow this  

how to encapsulation the "action"

This topic is 1730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

there are a lot of "action"s in a game.
some are simple,e.g. the disappearance of a buttom.
and some are complicated.e.g.the disappearance of a button array.
Is there a way to abstract the "action", making it the reuse and modification easy?
e.g.The convergence of the interface elements .Combination of elements of the game action , if the package is suitable , you can make the action more delicate and rich .

Share this post


Link to post
Share on other sites
Well, not just GUI, can also be some game elements.
Of course, if GUI can also.For all the elements interact with 
the user in the game are far-fetched called UI ? ^.^
Then taking GUI as an example to illustrate the problem.
For example a calculator (this is just an example), there are a lot of button.
If the calculator can "switch" between the common and scientific type,
and can "minimize", "maximize"......and so on.
What I mean by "Action" is used to describe the process of these changes.
Of course you can through some simple variables to describe the action, 
but when these movements became a lot,
Variable to describe becomes very messy.

Share this post


Link to post
Share on other sites

I think you need a state machine of some sort.

 

For example the calculator state would be in "basic math" mode or in "fancy math" mode.

 

The state machine will have "states" which will deal with their functionality along with initializing/destroying themselves.

 

So google that.

Share this post


Link to post
Share on other sites
Sign in to follow this