- Joined
- Aug 1, 2013
- Messages
- 4,658
Hi all.
I was wondering how I could create a generic/dynamic way of handling in-game objects' actions.
For example, I want my unit to jump, walk, stand, etc, but I dont want it to be able to walk while it is busy jumping but I do want it to be able to stand (stop) while walking.
I dont really know how to describe it properly so Google doesnt help me much either.
I have created a game at school where the teacher used a method to create a new class for each action that your object could make and make such a class handle what other actions are allowed.
But this would mean that I need like 40 classes for each individual object-type in game.
I have designed a slightly shorter version where you only have an interface and declare the actions withing the class of the object.
This does help quite some but I still have to write the actions out every single time.
Is there a good generic way of doing stuff like this?
I was wondering how I could create a generic/dynamic way of handling in-game objects' actions.
For example, I want my unit to jump, walk, stand, etc, but I dont want it to be able to walk while it is busy jumping but I do want it to be able to stand (stop) while walking.
I dont really know how to describe it properly so Google doesnt help me much either.
I have created a game at school where the teacher used a method to create a new class for each action that your object could make and make such a class handle what other actions are allowed.
But this would mean that I need like 40 classes for each individual object-type in game.
I have designed a slightly shorter version where you only have an interface and declare the actions withing the class of the object.
This does help quite some but I still have to write the actions out every single time.
Is there a good generic way of doing stuff like this?