Documentation
Shooting Range
Description
The Shooting Range module allows users to select correct answers from the elements that fall with a certain speed.
Properties
The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.
Property name | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Definitions | The list where you can define possible levels in the game.
|
||||||||||||
Initial time for answer | The time when the first answer falls. If the "Time for last answer" property is empty, then the answer time is equal to all properties. | ||||||||||||
Time for last answer | The time when the last answer falls. The rest of the answers will get the time proportionally to "Initial time for answer" and "Time for last answer". |
Supported commands
Command name | Params | Description |
---|---|---|
hide | --- | Hides the module if it is visible. |
show | --- | Shows the module if it is hidden. |
restartGame | --- | Restarts the game to the first level and resets the score. |
getResultsList | --- | Returns the list of player results. Each element is an object with the following structure: { score: playerScore, errors: playerErrors } |
Events
The Shooting Range module sends the ValueChanged event when the state has been updated.
Field name | Description |
---|---|
Item | [question number]-[answer number] |
Value | 1: if the value was clicked. 0: if an element was dropped. |
Score | 0: if the clicked element was wrong or the element was dropped. 1: if the clicked element was correct. |
The Shooting Range module sends the ValueChanged event when the game has been finished.
Field name | Description |
---|---|
Source | module ID |
Item | 'all' |
Value | 'EOG' |
Score | always: 1 |
Styles
class name | Description |
---|---|
addon-Shooting_Range-wrapper-question | Question wrapper. In this element, the module will set an actual definition. If definitions are empty, this element won't be displayed. |
addon-Shooting_Range-wrapper-answers-wrapper | Wrapper for answers. In this element, all answers will be added. The height of this element can't be changed by CSS. |
addon-Shooting_Range-play-button-wrapper | Wrapper for the play button. |
addon-Shooting_Range-button-play | Play button. Clicking on the button will start the game. |
addon-Shooting_Range-answer-wrapper | Wrapper of each answer element. |
addon-Shooting_Range-answer-[answer-number] | To distinguish answers, each answer will receive a unique class name. |
addon-Shooting_Range-answer-text | Each element of text in the answer will receive addon-Shooting_Range-answer-text class. |
addon-Shooting_Range-answer-layer | A layer used by the module. This class shouldn't be changed by the user. |
addon-Shooting_Range-wrapper-level | Wrapper for the current level of the game. |
clicked | If an element is clicked, it will get the "clicked" class. |
correct | On show errors, a correctly selected element will get the "correct" class. Or if a correct element is clicked, it will get the "correct" class. |
wrong | On show errors, a wrongly selected element will get the "wrong" class. Or if a wrong element is clicked, it will get the "wrong" class. |
isHidden | The style used by the module which shouldn't be used by the user. |
Examples
Example of using the getResultsList command
EVENTSTART
Source:Single_State_Button1
SCRIPTSTART
var shooting = presenter.playerController.getModule('Shooting_Range1');
shooting.restartGame();
var text = presenter.playerController.getModule('Text1');
var list = shooting.getResultsList();
var textToSet = "Correct:";
for (var i = 0; i < list.length; i++) {
textToSet += list[i].score;
}
textToSet += "<br />Errors:";
for (var i = 0; i < list.length; i++) {
textToSet += list[i].errors;
}
text.setText(textToSet);
SCRIPTEND
EVENTEND
Demo presentation
Demo presentation contains examples of how to use the Shooting Range module.