[Solved] Need help with CrazyGames portal ads

0 favourites
  • 10 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi there, hi CrazyGames_Official

    I'm on my way to publish a game on Crazy Games portal, and hope my game would be accepted on this very popular website, but I face a problem with the SDK/code.

    I want to display ad on a specific layout and once the ad finished, go to another layout.

    Here's my event, based on the official docs :

    It seems the await/Wait for previous actions to complete not working as I suppose it would.

    As I go to another layout, perhaps it bypasses the action, in this case, how to deal with this behavior ?

    I can't see a way to catch the "Ad finished" event like in the HTML5 SDK.

    Any ideas ?

    Thanks.

    Original post from CrazyGames, for reference : construct.net/en/forum/game-development/distribution-and-publishing-26/crazygames-sdk-construct-158941

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Show the entire piece of the event sheet where the ad is located.

    You cut out too little.

  • Hi igortyhon

    This is the entire event sheet. The ad can be displayed from multiple branches of the game so I created a specific layout for playing the ad on a black screen.

    I tried to play it from a function but the result was the same (not waiting the end of the ad to continue). Perhaps I misunderstand the way it works...

    Anyway, here's a gif showing the behavior. The layout is called after the player leaves the main game/layout. I want the ad to play and after that, come back to the main main "Menu cards" layout. As you can see, the ad is still visible when switching to menu.

    imgur.com/42jy9it

    Did you succeed to play ads on CrazyGames ?

  • Yes, my games make money on this portal.

    I asked you for a screenshot of the event sheet to see the errors in the use of SDK.

    Instead you show me a video of the work!?((

  • Thanks for your kind reply.

    I asked you for a screenshot of the event sheet to see the errors in the use of SDK.

    The screenshot shows the only event sheet calling the ad, as mentionned in my previous answer.

    Instead you show me a video of the work!?((

    What I show you is not my work but the behavior of the ad, at least the placeholder of the ad, to show that the layout is changing before the ad has finished.

    The other parts of the SDK are dispatched in other events sheets, and are running well by checking in Chrome DevTools and with the Q&A Tool provided by CrazyGames.

    The problem is that the event "Ad finished" don't seem to be catchable in C3 with the SDK. The ad starts, the layout switches and the background music starts to play over the ad...

    So I wonder how to wait the end of the ad to continue to the main menu.

    Perhaps you could show me a screenshot of how you do on your side, so I can compare with my events and logic ?

  • It's not a Trigger. It will be executed many times . Even if the time is 0.

    Here are my events for the interstitial ad display. Maybe they will help you.

    I have everything happening after clicking the "next levell" button.

    You don't have to wait for the ads to end, they don't happen in every call. SDK itself decides whether to show it or not.

  • Thanks a lot igortyhon!

    I realised my error when reading :

    It's not a Trigger

    So, I just added Trigger once and it was solved!

    I often talk with friends about the event system and I can't remember yet that the event sheet is "a kind of game loop", so as you said It will be executed many times....

    Unfortunately my game (a simple mahjong) has been rejected on CrazyGames, but anyway, I'm happy solving this problem. Thanks again.

    By the way, where can we play your games ?

  • kibaga.org

    Here's my website.

    I test games on google play first. Those that find players I put on web portals.

    On the mobile market you can improve and increase game metrics endlessly.

    On the web and Steam there is only one chance to get a good start.

  • Thanks for the link and advices.

    Indeed you have games with lots of installs, well done!

  • To catch the "Ad finished" event in the Crazy Games SDK, you can use the following code:

    // Add a listener for the "Ad finished" event

    crazySdk.addEventListener('adFinished', function() {

    // Go to the next layout

    System.gotoLayout('nextLayout');

    });

    // Display the ad

    crazySdk.displayAd('midgame');

    // Wait for the ad to finish

    await crazysdk.waitForAdToFinish();

    The waitForAdToFinish() method will block until the ad has finished playing. This ensures that the player is not taken to the next layout before the ad has finished playing.

    Here is a modified version of your event that uses the above code to catch the "Ad finished" event:

    // Display the ad on a specific layout

    System.setLayout('adLayout');

    crazySdk.displayAd('midgame');

    // Wait for the ad to finish

    await crazysdk.waitForAdToFinish();

    // Go to the next layout

    System.gotoLayout('menuCards');

    This event will display the ad on the adLayout layout and then wait for the ad to finish playing before going to the menuCards layout.

    I hope this helps!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)