Game to Web Events Firing

To send events from the game to ArcPlay, a message will need to be posted to the parent of the iframe in which the game is running. An example of this would be:

// Sent when user started the game
parent.postMessage({funcName: "game_start_success"}, "*");
// Sent when the web needs to show a rewarded video ad
parent.postMessage({funcName: "game_reward_click", rewardParams: { itemId: 1 }}, "*");

The data will be in the format { funcName: “string”, …other data } where funcName is the name of the event and any other data is sent as additional parameters. It can be one of the following.

Event Name
Firing Logic

game_init

When the game has started to load

game_update_load

Call this function every time there is an increase in the loading percentage of the game. MUST contain the loading percentage with the key name loadStatus as an additional parameter. The value of loadStatus should be an integer

game_load_success

When all the game assets are done loading. Usually on the start menu

game_start_success

When the game starts. Usually after the user clicks on “Play” or a similar button in the start menu

game_update_score

Call this function every time there is a score update inside the game. MUST contain the updated score with the key name liveScore as an additional parameter. The value of liveScore should be an double

game_reward_click

When the user clicks on a button to watch a rewarded video ad to unlock an item in the game MUST contain the reward parameters with the key name rewardParams as an additional parameter. The value of rewardParams will be sent back to the game from the web later.

game_paused

When the game has been paused. DON'T send this if the pause was triggered by listening to ArcPlay game_pause event

game_resumed

When the game has resumed

game_over

When the game is over, regardless of whether the user has won. MUST contain the final score with the key name score as an additional parameter. The value of score should be an double

Last updated