Creating a game in a block

This section is not a review of a contributed Moodle module; instead it is a quick guide to adding a game in a block in Moodle.

Getting ready

Find a free Flash game on the web and save it to your computer.

How to do it...

Copy the Flash game file to the Files area of your course in Moodle. Get the web path to the file by right-clicking on the file's name and copying the location of the file.

Go back to the course main page and add an HTML block from the Blocks menu.

How to do it...

Click on the configuration icon for the block. The configuration page for the block will appear as follows:

How to do it...

You can add a title for the block, but leaving it blank will omit the unnecessary block header (when editing is turned off).

In the WYSIWYG editor, switch to HTML source mode, by clicking the button on the bottom row of icons, second from the right, with a< > symbol on it.

Add the following HTML, replacing the URL http://localhost/moodle/file.php/2/invaders.swf with the URL of your Flash game file:

<object width="190">
<param name="movie" value="http://localhost/moodle/file.php/2/invaders.swf">
<embed src="http://localhost/moodle/file.php/2/invaders.swf" width="190">
</embed>
</object>

Save changes and when you return to your course page, there should be the Flash game in a block.

How to do it...

Tip

If the Flash game does not look large enough within a 190 pixel width column, you can achieve a similar result in a web page by selecting Compose a web page from the Add a resource... menu and using the same HTML code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset