Replacing the Images in Hangman

Replacing the Images in Hangman

by David Gustafson -
Number of replies: 9

Is it possible to have different sets of images for the Hangman game? We noticed on the settings page it has an option for "Select the images of hangman" with a dropdown that just says "1." We added other folders with images under mod/game/pix/hangman but the folders never show up, no matter how we label the folders or the files.

Please let me know if we're missing something. Thanks.

Average of ratings: -
In reply to David Gustafson

Re: Replacing the Images in Hangman

by Rob Baddorf -

I've been curious about this too.

Is this "select the images of hangman" not working or a function that has not yet been implemented?

Any help on this topic would be appreciated.

In reply to Rob Baddorf

Re: Replacing the Images in Hangman

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Just out of curiosity, I looked at that last week when David originally posed his question, but got interrupted by students before I had a chance to reply.

The option 1, appears to be hard coded. It is located in line 213 of mod_form.php which is located at yourmoodle/mod/game/mod_form.pgp.

So, you can change pictures a couple of ways. Ask the developers to implement the option, re-write the code yourself to let you actually select a different picture set, replace the set of 7 pictures in folder located....moodle/mod/game/pix/hangman/1 with your own set, add another folder of pictures and change the hard coded 1 to your desired folder.

AL

In reply to AL Rachels

Re: Replacing the Images in Hangman

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I had a few minutes between grading sessions, and it is actually very easy to fix hangman so that you can use your own pictures, or the original.

  • Create you own set of 7 pictures in a folder named 2 - I used the same names.
  • Place your new folder at yourmoodle/mod/game/pix/hangman/2
  • Edit line 213 of ...yourmoodle/mod/game/mod_form.php and change it to $a = array( 1 => 1, 2 => 2);
  • Under Game Administration go to Edit settings>Hangman Options>Select the images of hangman  and change it to 2.
  • Try out the game to see your new pictures in use.

AL

In reply to AL Rachels

Re: Replacing the Images in Hangman

by Rob Baddorf -

Would this edit allow for the use of GIF images instead of JPEGs?

Or is that hard coded as well?

Would that be an easy fix?

Thanks in advance. 


In reply to Rob Baddorf

Re: Replacing the Images in Hangman

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I don't know about other picture formats. Should be easy to test. Just make a set of gif's or png's and try them. They will either work or they won't. Turn on developer debugging and it should let you know right away.

AL

In reply to AL Rachels

Re: Re: Replacing the Images in Hangman

by Vasilis Daloukas -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Now does not support multiple set of images and images of different type.

On the last of May will be available a version that will support it.

In reply to Vasilis Daloukas

Re: Re: Replacing the Images in Hangman

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Excellent news. Now I can create a class competition and have students design their own sets of pictures for next year.

AL

In reply to Vasilis Daloukas

Re: Re: Replacing the Images in Hangman

by David Gustafson -

Al, thanks for the great pointers. I've done a bit of work with PHP, but my understanding is still limited. I appreciate you taking the time to explain this.

Vasilis, great news about the next version. We really appreciates this plugin and the work that you do with it. Thanks for letting us know what we can look forward to.

In reply to David Gustafson

Re: Replacing the Images in Hangman

by Vasilis Daloukas -
Picture of Particularly helpful Moodlers Picture of Plugin developers

The last version (2014071317) supports multiple image set and different type of images.

To create a second number of images you have to

a) go at Home / ► Site administration / ► Plugins / ► Activity modules / ► Manage activities

and in the Settings of Game

set "Number of image sets used by hangman" to 2

b) Go to parameters of game and sets the parameter "Select the images of hangman" to 2

c) Create a folder at the mod/game/pix/hangman with name 2

d) In that folder copy the files you want with names hangman_0.jpg, .., hangman_6.jpg

Instead of .jpg you can use .png or .gif