OLPCities/Changing avatares and auto-save: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 49: | Line 49: | ||
</html> |
</html> |
||
</pre> |
</pre> |
||
We have here a first cookie (avatcust). This cookie will have the name of the file (.GIF) having the avatar. If it's <b>null</b> this means that no avatar is defined. The kid go to the page: avatarcust.html (at the figure): |
|||
[[Image:Tut11-2.JPG]] |
|||
<pre></pre> |
Revision as of 17:59, 28 September 2006
At this last lesson of our tutorials serie we will learn how to make our OLPCity more sophisticated. It will be possible to choice an avatar and, if the kid go out of the OLPCity at some Lot X, when it comes back it will be at the same Lot X.
Look the figure. The folder having the Lots will have a file: index.html.
The code of this page is:
<html> <head> <script language="Javascript" src="http://www.dmu.com/olpc/gamelib_core.js"></script> <script language="Javascript" src="http://www.dmu.com/olpc/gamelib_sprites.js"></script> <script language="Javascript" src="http://www.dmu.com/olpc/gamelib_keyboard.js"></script> <script language="Javascript" src="http://www.dmu.com/olpc/gamelib_mouse.js"></script> <script language="Javascript" src="http://www.dmu.com/olpc/gamelib_interface.js"></script> <script language="Javascript"> function init(){ Sp_linuxcompatible=true; avatcust = new Gl_cookie("avatx"); if(avatcust.value==null ){ window.location="avatarcust.html" ; } else{ pointt = new Gl_cookie("ptt"); if(pointt.value!=null && pointt.value!="index.html")window.location=pointt.value; if(pointt.value==null ){ pointt.setvalue("tut11.html");//the first Lot of your City window.location="index.html" ; } } } </script> </head> <title>TUTCITY</title> <center> <body bgcolor="black" onload="init()" > </center> </html>
We have here a first cookie (avatcust). This cookie will have the name of the file (.GIF) having the avatar. If it's null this means that no avatar is defined. The kid go to the page: avatarcust.html (at the figure):