Bonus Clue-style Game


Kiko Escapes

This game takes my chamber-objects concept to the next ultimate step. The code builds a “Clue-style board game” in which the gamer attempts to find the correct combination of room color, monster-guardian and pixie clothing. This game is a “search and rescue” of poor lost Kiko (from the Winx Club cartoon series) and any pixies in the dreaded Ruins of Able-Wyvern™. Simply add your artwork; the game is in the download files /BonusGames/Kiko Escapes.

Refer to the book for more details and game rules.

//translated from Flash 10 AS3  
	var RoomA:Array = new Array("red   ","orange","yellow","green ","blue  ","purple","brown ","red   ","orange","yellow","
green ","blue  ","purple","brown ");  
	var Mnstr:Array = new Array("goblin  ","skeleton","zombie  ","mummy   ","goblin  ","skeleton","goblin  ","troll   ","go
blin  ","skeleton","zombie  ","troll   ","goblin  ","skeleton");  
	var Pixie:Array = new Array("red   ","orange","yellow","green ","blue  ","purple","brown ","red   ","orange","yellow","
green ","orange","yellow","green ");  
  
	var MT = new Array();	//from ARST  
	var RRD = new Array();	//from ARST  
	var clueA:Array = new Array("P = Red","B = Orange","M = Yellow","C = Green","U = Blue","B = Orange","E = Purple","");  
	clueA[8] = "The queen is guarded by a  monster.";  
	clueA[9] = "The queen was taken to the  room.";  
	clueA[10] = "The queen was dressed in  pixie clothes.";  
	clueA[11] = "";  
	clueA[12] = "";  
	clueA[13] = "";  
	  
	var DungA:Array = new Array();  
	DungA[0] = {id:" 0",room:"",monstr:"",pixie:"", clue:""};  
	DungA[1] = {id:" 1",room:"",monstr:"",pixie:"", clue:""};  
	DungA[2] = {id:" 2",room:"",monstr:"",pixie:"", clue:""};  
	DungA[3] = {id:" 3",room:"",monstr:"",pixie:"", clue:""};  
	DungA[4] = {id:" 4",room:"",monstr:"",pixie:"", clue:""};  
	DungA[5] = {id:" 5",room:"",monstr:"",pixie:"", clue:""};  
	DungA[6] = {id:" 6",room:"",monstr:"",pixie:"", clue:""};  
	DungA[7] = {id:" 7",room:"",monstr:"",pixie:"", clue:""};  
	DungA[8] = {id:" 8",room:"",monstr:"",pixie:"", clue:""};  
	DungA[9] = {id:" 9",room:"",monstr:"",pixie:"", clue:""};  
	DungA[10] = {id:"10",room:"",monstr:"",pixie:"", clue:""};  
	DungA[11] = {id:"11",room:"",monstr:"",pixie:"", clue:""};  
	DungA[12] = {id:"12",room:"",monstr:"",pixie:"", clue:""};  
	DungA[13] = {id:"13",room:"",monstr:"",pixie:"", clue:""};  
	  
	for (var i=0; i<= DungA.length; i++) {  
		// get a random room color
		var r:uint = Math.floor(Math.random() * RoomA.length); 
		// get a random monster color		
		var m:uint = Math.floor(Math.random() * Mnstr.length);  
		// get a random pixie color 
		var p:uint = Math.floor(Math.random() * Pixie.length); 
		  
		switch (i) {  
		case 0 :  
			DungA[0].room = RoomA[r];  
			// remove from room list 
			RoomA.splice(r,1); 
			DungA[0].monstr = Mnstr[m];  
			// remove from monster list 
			Mnstr.splice(m,1); 
			DungA[0].pixie = Pixie[p];  
			// remove from pixie list 
			Pixie.splice(p,1); 
			RRD[0] = "The " +  RoomA[r] +" Room";  
			MT[0] = {RmID:0, North:0, East:15, South:0, West:0, Up:100, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
		break;  
  
		case 1 :  
			DungA[1].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[1].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[1].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[1] = "The " +  RoomA[r] +" Room";  
			MT[1] = {RmID:1, North:0, East:17, South:0, West:14, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 2 :  
			DungA[2].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[2].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[2].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[2] = "The " +  RoomA[r] +" Room";  
			MT[2] = {RmID:2, North:0, East:18, South:0, West:15, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 3 :  
			DungA[3].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[3].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[3].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[3] = "The " +  RoomA[r] +" Room";  
			MT[3] = {RmID:3, North:0, East:19, South:0, West:16, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 4 :  
			DungA[4].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[4].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[4].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[4] = "The " +  RoomA[r] +" Room";  
			MT[4] = {RmID:4, North:0, East:20, South:0, West:17, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 5 :  
			DungA[5].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[5].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[5].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[5] = "The " +  RoomA[r] +" Room";  
			MT[5] = {RmID:5, North:0, East:22, South:0, West:18, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 6 :  
			DungA[6].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[6].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[6].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[6] = "The " +  RoomA[r] +" Room";  
			MT[6] = {RmID:6, North:0, East:23, South:0, West:19, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 7:  
			DungA[7].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[7].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[7].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[7] = "The " +  RoomA[r] +" Room";  
			MT[7] = {RmID:7, North:0, East:24, South:0, West:20, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 8:
			DungA[8].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[8].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[8].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[8] = "The " +  RoomA[r] +" Room";  
			MT[8] = {RmID:8, North:0, East:25, South:0, West:22, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 9:  
			DungA[9].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[9].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[9].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[9] = "The " +  RoomA[r] +" Room";  
			MT[9] = {RmID:9, North:0, East:26, South:0, West:23, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 10:  
			DungA[10].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[10].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[10].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[10] = "The " +  RoomA[r] +" Room";  
			MT[10] = {RmID:10, North:0, East:27, South:0, West:24, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 11:  
			DungA[11].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[11].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[11].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[11] = "The " +  RoomA[r] +" Room";  
			MT[11] = {RmID:11, North:0, East:28, South:0, West:25, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 12:  
			DungA[12].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[12].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[12].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[12] = "The " +  RoomA[r] +" Room";  
			MT[12] = {RmID:12, North:0, East:29, South:0, West:26, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
		case 13:  
			DungA[13].room = RoomA[r];  
			RoomA.splice(r,1);// remove from room list  
			DungA[13].monstr = Mnstr[m];  
			Mnstr.splice(m,1);// remove from monster list  
			DungA[13].pixie = Pixie[p];  
			Pixie.splice(p,1);// remove from pixie list  
			RRD[13] = "The " +  RoomA[r] +" Room";  
			MT[13] = {RmID:13, North:0, East:Exit, South:0, West:28, Up:0, Dn:0, Tres:0, Mnstr:m, Discovr:1};  
			break;  
	  
		case DungA.length :  
				var d:uint = Math.floor(Math.random() * DungA.length);// get a random room color  
				console.log("===================================================");  
				clueA[8] = "The queen is guarded by a "+ DungA[d].monstr + " monster.";  
				clueA[9] = "The queen was taken to the "+ DungA[d].room + " room.";  
				clueA[10] = "The queen was dressed in "+ DungA[d].pixie +" pixie clothes.";  
				console.log("Room Answer: "+d);  
				console.log("\n Answer: "+DungA[d].id + ") Room: "+ DungA[d].room + ";\t\t Monster: "+ DungA[d].monstr + ";\t\t Pixie: "+ DungA[d].pixie +"\t\t Clue: "+ DungA[d].clue +"\n")  
				break;  
	  
		}  
	}  
		for (var ii=0; ii<= DungA.length; ii++) {  
		var c:uint = Math.floor(Math.random() * clueA.length);// get a random clue  
		  
		switch (ii) {  
			case 0 :  
				DungA[0].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
	  
			case 1 :  
				DungA[1].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 2 :  
				DungA[2].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 3 :  
				DungA[3].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 4 :  
				DungA[4].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 5 :  
				DungA[5].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 6 :  
				DungA[6].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 7:  
				DungA[7].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 8:  
				DungA[8].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 9:  
				DungA[9].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 10:  
				DungA[10].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 11:  
				DungA[11].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 12:  
				DungA[12].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
			case 13:  
				DungA[13].clue = clueA[c];  
				clueA.splice(c,1);// remove from clue list  
				break;  
	  
		case DungA.length :  
				console.log("==================================================");  
				console.log("Room Answer: "+d);  
				console.log("\n Answer: "+DungA[d].id + ") Room: "+ DungA[d].room + ";\t\t Monster: "+ DungA[d].monstr + ";\t\t Pixie: "+ DungA[d].pixie +"\t\t Clue: "+ DungA[d].clue +"\n")  
				break;  
	  
		}  
	  
		if (ii!=DungA.length){  
			if(ii>9){  
				console.log(DungA[ii].id + ") Room: "+ DungA[ii].room + "; \t \t Monster: "+ DungA[ii].monstr + "; \t \t Pixie: "+ DungA[ii].pixie +" \t \t Clue: "+DungA[ii].clue);  
			}else{  
				console.log(DungA[ii].id + ") Room: "+ DungA[ii].room + "; \t \t Monster: "+ DungA[ii].monstr + "; \t \t Pixie: "+ DungA[ii].pixie +" \t \t Clue: "+DungA[ii].clue);  
			}  
		}  
	}  
	console.log("==================================================");  
	  
	//ARST - Preload Movement Table  
	//  
	// -------------------------------------------  
	// Movement Table  
	// -------------------------------------------  
		//MT = new Array();  
		//ARST Dungeon Framework & infrastructure; converted for Kiko Escape 20130529  
	/* Fixed assignments above  
		MT[0] = {RmID:0, North:0, East:15, South:0, West:0, Up:100, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[1] = {RmID:1, North:0, East:17, South:0, West:14, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[2] = {RmID:2, North:0, East:18, South:0, West:15, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[3] = {RmID:3, North:0, East:19, South:0, West:16, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[4] = {RmID:4, North:0, East:20, South:0, West:17, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[5] = {RmID:5, North:0, East:22, South:0, West:18, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[6] = {RmID:6, North:0, East:23, South:0, West:19, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[7] = {RmID:7, North:0, East:24, South:0, West:20, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[8] = {RmID:8, North:0, East:25, South:0, West:22, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[9] = {RmID:9, North:0, East:26, South:0, West:23, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[10] = {RmID:10, North:0, East:27, South:0, West:24, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[11] = {RmID:11, North:0, East:28, South:0, West:25, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[12] = {RmID:12, North:0, East:29, South:0, West:26, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[13] = {RmID:13, North:0, East:Exit, South:0, West:28, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
	*/  
		//Randomized Corridor Content from here down.  
		MT[14] = {RmID:14, North:0, East:1, South:15, West:0, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[15] = {RmID:15, North:14, East:2, South:16, West:Start, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[16] = {RmID:16, North:15, East:3, South:0, West:0, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[17] = {RmID:17, North:0, East:4, South:18, West:1, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[18] = {RmID:18, North:17, East:5, South:19, West:2, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[19] = {RmID:19, North:18, East:6, South:0, West:3, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[20] = {RmID:20, North:0, East:7, South:21, West:4, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[21] = {RmID:21, North:20, East:0, South:23, West:0, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[22] = {RmID:22, North:0, East:8, South:0, West:5, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[23] = {RmID:23, North:21, East:9, South:0, West:6, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[24] = {RmID:24, North:0, East:10, South:0, West:7, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[25] = {RmID:25, North:24, East:11, South:26, West:8, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[26] = {RmID:26, North:25, East:12, South:0, West:9, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[27] = {RmID:27, North:0, East:0, South:28, West:10, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[28] = {RmID:27, North:27, East:13, South:29, West:11, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[29] = {RmID:27, North:28, East:0, South:0, West:12, Up:0, Dn:0, Tres:0, Mnstr:0, Discovr:1};  
		MT[30] = {RmID:27, North:100, East:100, South:13, West:13, Up:100, Dn:13, Tres:0, Mnstr:0, Discovr:1};  
	//  
	//  

See Flash game in your Book Downloads

Copyright © 2017, Stephen Gose LLC.
All rights reserved.