This is more of a question how other people would handle this issue. I am making a sim farm game. I have all logic for animating the player, objects, simple quests and things need need to do etc. I am now thinking of how I am going to interact with different objects. For example, my character when you click 'e' could do a number of things depending on what she is interacting with. If the item is a grass tile she will hoe it, if it's a dirt tile she could put down seeds, if it's a crop then she will water it, if it's a mailbox check the mail or something.
In more simple games I have just had a bit if statement in the update method. I don't want to do this because I want it to be more robust and expandable. I was thinking that when the action button is clicked an action object is sent to whatever objects are clicked and if they can handle them then they will themselves? Almost like a chain of command pattern.
HoeAction : BaseAction
WaterAction : BaseAction
CheckMailAction : BaseAction
if input = e then
selectedTool = selectedinventory
objects = getallselectedobjects()
for each object in objects
I don't know if this all makes sense, perhaps I just need a bit of a hand organizing and focusing. I appreciate any input from you guys. If any of it is unclear or I am just not making sense I can try to elaborate more with code etc.
I'm SteveMember Since 18 Dec 2011
Offline Last Active May 12 2012 09:33 AM
- Group Members
- Active Posts 3
- Profile Views 513
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
I'm Steve hasn't added any contacts yet.