objects/obj_cat.lua

Sat, 27 Mar 2010 17:43:08 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 27 Mar 2010 17:43:08 +0000
changeset 0
cc66ad6b0d75
permissions
-rw-r--r--

Initial commit (importing from old SVN repo which got lost)


-- This is an example of one way of coding a class, using the { } constructor, see the fireplace for another method

classes.obj_cat =
{
	_properties = { name = "cat", longname = "a mother cat", desc = "You see at a furry object curled up in a corner. It watches comers and goers to this room as they pass." },
	stroke =	function (self, e)
				e.person:_say("/me strokes the "..self._properties.name); -- This message is said by the person who stroked the cat
				self:_say("/me purrs softly"); -- This message is said by 'self' which means the current object, the cat
			end,
			
	kill = 	function (self, e)
				e.person:_say("/me tries to hurt the cat");
				self:_say("/me runs away before "..e.person.nick.." can catch it");
				self:_say("Meeooooww!!!!");
			end,
			
	hug =	function (self, e)
				e.person:_say("/me hugs the cat");
				self:_say("/me likes "..e.person.nick);
			end
}

mercurial