Island Creator/Multiplayer 2D applications (conclusion)

From Croquet Consortium

Jump to: navigation, search

9 - Click in the square (3th from left) and a window will open having the script that puts "abc" in the Textborder. "self" means: "me", this Text... Change "abc" to "Hello World". Rightclick to do an "accept". Click in the "exclamation point" (yellow) and the text will change.

Fig.18-1
Enlarge
Fig.18-1

VERY IMPORTANT: Pay attention to the fact that was created a "prefix" for the Class Textborder. To call the method/function setCharacters:param. Here the "prefix" is self, because the script is glued to the object itself.


TIP: An usual error is not to do the "accept" and try to run the script. Nothing will happens...


10 - Now that you know that your 2D application (very simple here), is working well you need to clean the page closing the auxiliary windows (Object Viewer and Script Viewer, here). The "X" in the window destroy it. Like our intention is only to close, use the "O".

Another thing to do is the correct positioning of the 2D object in the page, moving it, using the icon of the halo.

You need also to remove the "Tools pallete":

Fig.18-2
Enlarge
Fig.18-2

A 2D application is, for Squeak, a "project".

Any Cobalt island has a "Squeaklets folder" that is the inventory for Squeak projects available for this island. The "Squeaklets folder" of the "SanMinimum island" we are using is: SanMinimumSQ. There are a generic "Squeaklets folder" whose name is: "Squeaklets" - we don't recoment its use to avoid replacement of projects of different islands having the same name.

11 - To "save" your project, open a "World Window" and click: save project on file. Appears a window where you define a name for the application (we will use "proj1") and some other details, if you like.

Fig.18-3
Enlarge
Fig.18-3

Clicking "OK", appears a blue window where you select the "Squeaklets folder" of your island and click "Save".

12 - Now you need to put your 2D application inside a "Panel" inside your island. To do it, in the "World Window" select: previous project. You will return to the default page of the "Cobalt Browser and Creator", having a little image of the project at the superior left side. You can remove it using its halo.

Like we did for the sound in previous lesson, to add our project to the space of the island we need to open the method "initialize" of the Class CobaltWorld.

The new "initialize" including our "proj1" will be:

initialize

| space floor mF  project1 win |

	 
space := TSpace new.
space registerGlobal: #mainEntry.
self makeLight: space. 
 
floor := self makeFloor: space fileName: 'lawn.bmp'.
floor extentX: 100 y: 0 z: 100.	 
 
mF:= MainFrame new.
space addChild: mF.

 
self makeRegistered1: space. 

project1 := self makeMorphic: (MessageSend
   receiver: MorphicWorldHost
   selector: #makeProjectLink:extent:from:
   argument: 'proj1')
   extent: 768@768.

   win := TWindow new.
   win translationX: 15 y: -2 z: -15.
   win contents: project1.
   win closeContents.
   space addChild: win.

^space.

And, after the "accept", you can see your island:


Fig.18-4
Enlarge
Fig.18-4


Your new version of the "San Minimum island" can be saved ("big save") like, by example: SanMinimum2.image.

VERY IMPORTANT: If you like that other persons having the original "SanMinimum island" can access this modified version of the island, you need to send to them, the new .image + .changes files and the file proj1.001.pr to be added to their folder SanMinimumSQ. You need to remember always the WonderLand paradigma

13 - To open the 2D application in the Panel, you need to click 3 times the "+ signal" in the superior bar:

Fig.18-5
Enlarge
Fig.18-5

If you have 2 computers and a WiFi network you can test that our application is multiplayer:

Fig.18-6
Enlarge
Fig.18-6

Click in the arrow over the Panel to have it in front of you.

If any of the visitors (or the owner) of the island changes the text inside the Textborder it will change at any copy of the island at the other computers.

Fig.18-7
Enlarge
Fig.18-7


RELATED LINKS: Previous lesson<...>Next lesson
Table of Content <...> Cobalt Wiki Main Page
Views
Personal tools