[Tutor] Functional Programming in Python
WolfRage
wolfrage8765 at gmail.com
Sun Apr 5 03:53:28 CEST 2015
<SNIP>
So I was surprised I did not get more feedback on my abused coroutine,
maybe that is good or bad, not sure.
Any ways I am on to trying to make that coroutine act more like the
State Pattern from Gang of Four. And well reading this:
http://gameprogrammingpatterns.com/state.html
I am not sure how to do this:
class Heroine
{
public:
virtual void handleInput(Input input)
{
state_->handleInput(*this, input);
}
virtual void update()
{
state_->update(*this);
}
// Other methods...
private:
HeroineState* state_;
};
(Pointing to the different classes. Since C++ has virtual methods but
Python does not?) in Python? Do I just reference the new method? Because
state_ will always be the correct object?
More information about the Tutor
mailing list