//for the text area, I plan to import the P5 Controls //...from this library url: //... http://www.sojamo.de/libraries/controlP5/examples/ControlP5textarea/ControlP5textarea.pde //here is the where I import the text area... import controlP5.*; Textarea myTextarea; void setup () { size (1082, 767); //the largest image I have uploaded is 1082 x 767... I will extend the size to include the text box... controlP5 = new ControlP5(this); myTextarea = controlP5.addTextarea ( "label1", "a textarea is of type group, not controller.\n"+ "you can set the width and height of a textarea, if there is more text than space available, scrollbars are added. "+ "use ALT + mouseDown to move the textarea.", 100,100,200,60); controlP5.addSlider("changeWidth",0,200,100,100,20,100,9); controlP5.addSlider("changeHeight",0,200,100,100,60,100,9); myTextarea.setColorForeground(0xffff0000); //here are where the room objects are called... Room r1 = new Room("Title Screen","Welcome to my game, here are the available text commands: NORTH, SOUTH, EAST WEST, SOUTHWEST, SOUTHEAST, TOUCH, SNORT, GET, READ DROP, INVENTORY, Y/N... Press space bar to enter Second Life for the first time!","aboutthetextadventurebackground.jpg"); Room r2 = new Room("Orientation Island","Welcome to Second Life. You have arrived at Orientation Island and have become what the locals call a 'newbie' or a 'nOOb' with a normal male humanoid appearance...YAWN! Do you want to edit your appearance?","OrientationIsland.jpg"); Room r3 = new Room("Congrats on your new appearance!","Congrats! Your appearance looks very trendy and stylish! It was as if you were born to be a star! What awesome hair! In fact, you look so cool that people have already taken notice!! Do you want to go to your new freshly built home on Sugar Mountain? ","Wirxli_Flimflam_appearanceready.jpg"); Room r4 = new Room("Game Over #1","WHOA! You have just made a SERIOUS mistake! Every celebrity knows that to truly become famous, you must at least LOOK cool! What were you thinking? I mean, what kind of mediocre dullard would turn down the ridiculously easy offer to become almost instantaneously famous by simply saying 'yes'? Ooops! I guess it was YOU who turned down the offer...you, and millions of other dupes who accidentally sabotaged their formerly unbridled access to fame and fortune. Well, now you have resigned to a rather boring and pointless existence as a transient nobody...GOOD LUCK AND GAME OVER!","nOOb_boringending.jpg"); Room r5 = new Room("PR Office","GOOD CHOICE! Within minutes of styling your hair, you have already earned a few friends! Your newest friend is a curator named Sugar Seville. She has built you this new home on Odyssey Island. Consider it as a shrine to your snazzy personality!", "PR_Office.jpg"); Room r6 = new Room("Purple Text","Look, stop playing around and seize the opportunity when you get it, ok? Just because you have had your first taste of glamour after only one successful decision does not make you a star overnight (yet). So, NOW do you want to go to your freshly designed pad on Sugar Mountain?", "purpletext.jpg"); //Room r7 = new Room ("Dance Party", "Wow! All it takes is a little bit of coke and already, you are the LIFE OF THE PARTY! This is definitely the place to see and be seen...but...NOW WHAT? Should you go somewhere?", "Wirxlibadd_2006_08.jpg"); //room r8 = new Room ("Kenzo Answers the iphone", "RING! As soon as you pick up the phone, the phone rings and it just happens to be the well known celebrity organizer, In Kenzo who is on the phone...She was hoping to get ahold of Sugar Seville who happens to own the phone but she is more than happy to speak with you for the first time...After a quick compliment about your crazy hair (did we mention that this iPhone has videochat?), Kenzo invites you to the Avastar Party...do you want to go?", "InKenzoImage.jpg"); //Room r10 = new Room("Coke Overdose!","...", "cokeOD.jpg"); //These room commands provide the navigation from room-to-room/event-to-event/textprompt-to-textprompt... r1.setRoomCommand(r2," "); r2.setRoomCommand(r3,"Y"); r2.setRoomCommand(r4,"N"); r3.setRoomCommand(r5,"Y"); r3.setRoomCommand(r6,"N"); // r4.setRoomCommand - does not exist because this room is one of the "game over" screens. r5.setRoomCommand(r7,"SNORT COCAINE"); r5.setRoomCommand(r8, "GET iPHONE"); r6.setRoomCommand(r5,"Y"); //r7.setRoomCommand.... //r8.setRoomCommand... image(r.roomImage,0,0); } void draw () { } //more function calls related to the P5 controlled text area... void changeWidth(int theValue) { myTextarea.setWidth(theValue); // ((Textarea)controlP5.group("label1")).setWidth(theValue); } void changeHeight(int theValue) { myTextarea.setHeight(theValue); } //PImage image1; //PImage cokeOD; Room room1; //room1 = new Room("sakjh","hfjaehdf","); Room roomCoke; class Room{ String name;//name of the room String description;// description which should be shown to the user when he enters the room PImage roomImage;//Image of room (if you want to support different angles of view, please tell me, we should change the code in that case) ArrayList rooms=new ArrayList();//list of the rooms available to go from this room ArrayList commands=new ArrayList();//list of the commands available for the room ArrayList items=new ArrayList();//list of the itms available for this room (we should talk more about this) //Constructor Room(String name,String description, String imageFileName){ this.name=name; this.description=description; roomImage=loadImage(imageFileName); //PImage imageFileName1; //imageFileName1 = loadImage (imageFileName); //image(imageFileName1,0,0); } //after each commands, which room should we go to? void setRoomCommand(Room r, String command){ rooms.add(r); commands.add(command); //TODO : add r to rooms list and add the command to commands list // by this method we specify that after for example "Yes" the user should go to room number 2 //also it is good to check if there is a predefined the same command //I mean we shouldn't allow this room to have more than one "East" command for example. } //gets a command like "Yes" and returns the appropriate room Room nextRoom(String command){ int index=commands.index.Of(command); Room r=(Room) (rooms.get(index));//we can search the commands list, if the command parameter is the second unit of commands list, //our method should return the corresponding room (second unit of rooms list in this example) //if the command is not in the list, this method should return null (no room found) return r; } }