I am about to start programming my game object class and I am running into a bit of confusion.
This game is a 3d game, with a 2d UI. Objects can be picked up off of the 'ground' and an icon associated with that item is placed in the users inventory.
If the user picks up a 3d object, when he clickes and drags the object, it turns into the 2d icon. When the user drags the 2d icon from their inventory and drops it on the screen, the 3d object is placed on the ground.
When the user equips a sword or armor, etc. They drag (or double click) the icon in their inventory, and then drop it on a 2d character sheet. When they do this, the proper mesh subgroup is hidden/revealed(in the case of armor) or the proper mesh is loaded from file and attached to the proper attach point, such as weapons or other attachable objects. Also the proper texture for the object is applied to the map channel (in cases where objects have the same base mesh, but different textures).
Some objects in the world are 'usable' such as a doors, turning on or off lights, putting out a fire, etc. They can use the object, but they don't pick it up.
Most objects will have various leftClick, rightClick, doubleLeftClick, onHover, onHoverEnd, functions, etc. This goes for both 2d and 3d versions. (such as you can hover over the item in your 2d inventory to see the stats of the item, or you can hover over the item on the ground to see what the items name is). These will sometimes be the same, but sometimes different.
So what do you suggest for my world object class or inherited classes look like?
I was thinking of something like:
//psuedo
class GameObj
var scriptFile2d //script file to be used for the 2d version of the object
var scriptFile3d //script file to be used for the 3d version of the object
var meshDefinition //mesh to be used
var iconDefinition //icon to be used
var objType //such as sword1h, sword2h, food, gloves, etc.
var objOwner //the npc, container, or map this obj belongs to
function make3d(pos, rot, scale) //function to make the 3d version of the obj
function make2d(pos, rot, scale) //function to make the 2d version
Next I will have the scripts for the two versions..
// js include file for the object script
function onUse()
function onEquip()
function onRemove()
function itemRef() //this is used to refer back to the GameObj
function leftClick()
function rightClick()
function doubleClick()
function hoverBegin()
function hoverEnd()
The main difference between the 2d and 3d are some texture/color info...
var ambDiffuse
var spec
var emiss
var texMap
// js include file for the object script
function onUse()
function onEquip()
function onRemove()
function itemRef() //this is used to refer back to the GameObj
function leftClick()
function rightClick()
function doubleClick()
function hoverBegin()
function hoverEnd()
Ok so I guess for the GameObject, I will also need things like longDescription, shortDescription, prerequisites, damageMin, damageMax, range, quantity, condition, buyPrice, sellPrice, and everything else I forgot.
What about specific objects for quest items?
So you can see I am a bit overwhelmed about all of this. Any examples of your game hierarchy or super/extended classes, I would appreciate it a lot.