objects/obj_cat.lua

changeset 0
cc66ad6b0d75
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objects/obj_cat.lua	Sat Mar 27 17:43:08 2010 +0000
@@ -0,0 +1,22 @@
+
+-- 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