Been a while since I've been here last, so I don't know if this has been discussed before.
I'm currently working on a game where I need to setup a scripting engine. The scripting engine will be fed scripts which are defined by the user.
There is an encounter, when the alarm has been raised (this is stored in a global variable, when a trap is triggered), 3 goblins are added to the encounter. finally 3 golbins are added to the encounter whether the alarm has been raised or not.
This script is provided in a text file, but the functionality has to be mapped to actual Java. I'm not quite sure how to do this. I was thinking of setting up an encounter class, with internal classes for each method. (these can then be accessed via a factory). But I'm not quite sure this is the way to go, since it produces a lot of overhead.
Any help would be appreciated.
PS. if anyone is interesteed in helping out with the game, please PM me.
I think an encounter class would work good, you will need to specify different types of encounters, so you could make the encounter class a super class of a whole lot of sub classes which inherit common methods from the encounter class, such as addEnemies and such...??
A kram a day keeps the doctor......guessing
found a link on devx about this subject that might prove usefull:
going to try this approach later today, see if this is a better waqy to go about it. Form a first glance, it looks like a nicer way to do this, although I will stiull need an Encounter class, I should be able to find a simpler way of invoing methods on that class.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center