Post by dpman03 on Mar 8, 2011 15:40:54 GMT -5
I found your site recently, and was really impressed with what you've done so far. I decided to download the source code for the game and thought I'd try adding some extra items. I then spent an inordinate amount of time trying to figure out exactly how items are actually coded.
From what I can tell, the image and an empty constructor class for each item is contained in the main .fla file. It looked like the actual behavior is coded in one of the .as files (items.as IIRC), and that each item has a specific number used to track it. I'm not sure I ever figured out exactly where statistics, etc are actually modified.
Considering that actionscript is object-oriented, it might make things a lot easier if everything about an item was inside the actual definition class for the item. You could create a super-class that defines certain required methods and override those for each specific item that extends from that super-class. Then you would call those methods at the appropriate time, such as each shift, or when an item is equipped.
Some examples methods might be as follows:
onEquip() - what happens upon equipping
onRemove() - what happens upon removing
itemType() - where is the item equipped, or is it something else
canEquip() - can the item be equipped now
canRemove() - can the item be removed now
onShift() - what happens on each new "shift"
onShift........() - what happens on a specific shift
onJob() -what happens during a job / action
I noticed you've been instantiating a lot of the game lately, and using the above method would be a good way of streamlining items. More importantly, it would make it pretty simple for anyone to add their own items to the game. I'd be glad to make an example of the superclass and a couple of items if it would help, but I'm not sure I have the time to decipher some parts of the game code enough to fully implement it myself.
From what I can tell, the image and an empty constructor class for each item is contained in the main .fla file. It looked like the actual behavior is coded in one of the .as files (items.as IIRC), and that each item has a specific number used to track it. I'm not sure I ever figured out exactly where statistics, etc are actually modified.
Considering that actionscript is object-oriented, it might make things a lot easier if everything about an item was inside the actual definition class for the item. You could create a super-class that defines certain required methods and override those for each specific item that extends from that super-class. Then you would call those methods at the appropriate time, such as each shift, or when an item is equipped.
Some examples methods might be as follows:
onEquip() - what happens upon equipping
onRemove() - what happens upon removing
itemType() - where is the item equipped, or is it something else
canEquip() - can the item be equipped now
canRemove() - can the item be removed now
onShift() - what happens on each new "shift"
onShift........() - what happens on a specific shift
onJob() -what happens during a job / action
I noticed you've been instantiating a lot of the game lately, and using the above method would be a good way of streamlining items. More importantly, it would make it pretty simple for anyone to add their own items to the game. I'd be glad to make an example of the superclass and a couple of items if it would help, but I'm not sure I have the time to decipher some parts of the game code enough to fully implement it myself.