-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe MazeWeb #10
Comments
Quick introduction to the game and its mechanics before diving into the code. Principle of the gameAfter a short animation, the player is presented a game screen containing a maze and a little smiley face. Player input and game mechanicsTo move around, the player has two options. They can either left-click or use arrow keys. MenusThere are no menus in this activity as explained in the first section. |
Template activityThe code part is going to be a little bit messier as I'm also learning how Sugarizer activities work. loader.jsThe loader.js file is used to setup imports from the libs to the activity.js file. requirejs.config({
baseUrl: "lib",
paths: {
activity: "../js"
}
});
requirejs(["activity/activity"]); All libraries that need to be loaded and that are defined by calling shim: {
'rot': {
exports: 'ROT'
},
// OTHER LIBRARIES
} To import libraries, see the next section. activity.jsLocated in the js directory, this is the main JS file. define(["sugar-web/activity/activity" /* OTHER DEPENDENCIES */], function (activity, /* OTHER IMPORTED STUFF */) {
// Manipulate the DOM only when it is ready.
requirejs(['domReady!'], function (doc) {
// Initialize the activity.
activity.setup();
// YOUR CODE GOES HERE
});
}); In I think that's it for what I could understand of the basic structure of a sugarizer activity. |
They way this, and many other, activities are structured is sort of two parts, as described in architecture doc. There is the sugar-web code that added the top bar and other sugarizer elements to the activity page, and then there is the activities code than renders the rest of the activity. These can be more or less separate, depending on the activity. |
When the user starts an activity all that happens is the the browser navigates to that activities index.html page. So lets start by looking at that. First we have this section that creates the sugarizer tool bar at the top of the page <div id="main-toolbar" class="toolbar">
<button class="toolbutton" id="activity-button" title="My Activity"></button>
<button class="toolbutton" id="network-button" title="Network"></button>
<button class="toolbutton pull-right" id="stop-button" title="Stop"></button>
<button class="toolbutton" id="restart-button" title="Restart"></button>
</div> Basically every activity needs to have this in some form, otherwise the user wouldn't be able to leave the page. The css and js to make this work in included in the head section and live in the After this in the body is the html where the actual game is rendered <div id="canvas">
<canvas id="maze"></canvas>
</div> In the case of Maze web, it's basically just and html canvas that the js code can render onto. |
Synthesizing the content of this issue into a document to put in https://github.com/ritjoe/sugarizer-lite/tree/master/hfoss-2195 might be a good way to get your contribution to this issue. |
This issue will be used to discuss the documentation of MazeWeb, a sugarizer activity (thus coded in JavaScript) as an example of the components and behaviors we need to use in our ports of sugar activities to sugarizer.
As described in https://github.com/ritjoe/sugarizer-lite/wiki/describe-sugarizer
The text was updated successfully, but these errors were encountered: