[Sugar-devel] [Karma] Re: Conozco Uruguay in karma

Bryan Berry bryan at olenepal.org
Fri Oct 9 00:49:55 EDT 2009


Hey Ze,

Great start!

I cloned your git repo and made a few changes
http://github.com/bryanwb/Conozco-Uruguay


Just a few notes:

U don't need the xml declaration anymore w/ html5
so  <?xml version="1.0" encoding="iso-8859-1"?> and 
   xmlns="http://www.w3.org/1999/xhtml"   are no longer needed

all u need is <!DOCTYPE html> 

I have copied the needed js files into js/ so u can run it as a
standalone. Perhaps I should create a karma-base package that just has
all requirements for creating a standalone lesson and nothing more.

You can use jquery methods to make your code more succinct

for instance:

document.getElementById('mycanvas').addEventListener( . . . 

can become

$('#mycanvas').bind('click', clicked, false);

and

document.getElementById('question').innerHTML = q.getPhrase;

can become

$('#question').html(q.getPhrase);


I also see that you used static coordinates to represent the cities.
This means the image can't be resized for different screen resolutions.
It would be neat if we could do the same image as an SVG w/ the names of
the capitals embedded as nodes. Then you could attach an event listener
to each node.

Each node would have an ID matching the City name and class="cities".
You could then match the ID of the element clicked on against the city
named in the question.

Unfortunately, I have no idea how to do this ;)


On Thu, 2009-10-08 at 18:04 +0100, Ze maria wrote:
> Hello guys,
> I started a port of the activity "Conozco Uruguay" (available at
> http://activities.sugarlabs.org/en-US/sugar/addon/4199) from Python to
> the new Karma framework (downloaded from:
> http://git.sugarlabs.org/projects/karma).
> I'm new to html5 and to the canvas element so don't be scared by the
> lookn'feel :)
> 
> 
> Currently to only thing implemented is the capital game, where a
> person guesses where which capital of the state is located.
> 
> 
> By the way, I coulnd't get to work the Raphael function 'print', every
> time I try to use I get a :
> 
> 
> Error: f.fonts is undefined
> Source File:
> file:///Users/zemariamm/workspace/olenepal/mainline/js/raphael-min.js
> Line: 7
> 
> 
> 
> 
> The code is available at http://github.com/zemariamm/Conozco-Uruguay
> Comments, critics and sugestions are all welcome :)
> 
> 
> (To run the code just download the new karma framework and drop the
> urugay activity code in the lessons directory)
> 
> 
> Take care,
> Jose
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
-- 
Bryan W. Berry
Senior Engineer
OLE Nepal, http://www.olenepal.org



More information about the Sugar-devel mailing list