dop2000's Recent Forum Activity

  • I usually use some character, for example ^. And then replace this character with newline expression.

    For example, you may have this text in the dictionary:

    Hello there,^general Kenobi!

    When you're showing it on the screen, you can do this:

    Text set text to replace(Dictionary.Get("greeting"), "^", newline)

    .

    And of course you can optimize the code by creating a function, which will return formatted text from the dictionary for any key.

  • No, I meant you only need to load one file. If device language is English, load English file, if Russian - load Russian. Use the same AJAX tag. So as a result, the dictionary will contain strings only for one language.

  • Check out this template:

    editor.construct.net

    I've also seen a few tutorials, you can try googling.

    I think the easiest way would be using a dictionary. Prepare a separate dictionary file for each language in the project, for example "Strings-EN.json", "Strings-FR.json"

    On startup when you detect device language, request the required file with AJAX and load it into the Lang dictionary. In this dictionary you can use codes as keys and translations as values. For example, the key can be "GameOverText" and the value in the French file can be "Jeu terminé!"

    And then you set text for your text object to Lang.Get("GameOverText")

  • I don't understand your setup. Are level buttons instances of one sprite? Or are they different sprites?

    The easiest way is to make one sprite object LevelButton, and add "Level" instance variable to it. Manually set level numbers to all buttons in the layout editor. Then you can use "LevelButton compare variable" to reference them.

    For example:

    LevelButton compare variable Level>(CurrentLevel+1)
    	LevelButton set invisible
    
  • Why are you picking Family1, and not Spawner sprite directly?

    You can also use "System Pick All Family1" condition in a sub-event.

    Bullet on collision with Family1
    
    	Pick All Family1
    	Family pick with UID Bullet.SpawnerUID
    
    
  • When you use & operator with integer values, it works as boolean "AND" operator. You need to tell Construct that you are concatenating string values.

    You can try this:

    Set result to ""&val1&val2&val3 etc.

    Or convert them to strings:

    Set result to str(val1)&str(val2)&str(val3)

  • Another option is to remove all references to this plugin, it's possible that ads will work without it.

    So you can try changing the script like this:

    function onDeviceReady() {
    
     console.log('Initializing API');
     document.getElementById('deviceready').classList.add('ready');
    
     const rivendell = window.rivendell
     console.log('banner align: ' + rivendell.BANNER_ALIGN.BANNER_HORIZONTAL_CENTER)
    
     rivendell.setBannerCallback(callback => {
     console.log("setBannerCallback event: " + JSON.stringify(callback.event))
     console.log("setBannerCallback error: " + JSON.stringify(callback.error))
     })
    
     rivendell.setInterstitialAdCallback(callback => {
     console.log("setInterstitialAdCallback event: " + JSON.stringify(callback.event))
     console.log("setInterstitialAdCallback error: " + JSON.stringify(callback.error))
     })
    
     rivendell.setRewardedAdCallback(callback => {
     console.log("setRewardedAdCallback event: " + JSON.stringify(callback.event))
     console.log("setRewardedAdCallback error: " + JSON.stringify(callback.error))
     })
    
     let appKey= "PUT ANDROID APP ID HERE";
     
     console.log("appKey: " + appKey)
     if(appKey == null)
     return
    
     rivendell.init(appKey, callback => {
     console.log("rivendell init: " + JSON.stringify(callback))
     switch (callback.event) {
     case rivendell.Event.ON_INIT_SUCCESS:
     console.log("init SUCCESS")
     break
     case rivendell.Event.ON_INIT_FAILED:
     console.log("init FAIL")
     break
     }
     })
    }
    
    function isBannerLoaded() {
     window.rivendell.isBannerAdLoaded(callback => {
     alert("Banner loaded: " + JSON.stringify(callback))
     })
    }
    
    function showBanner() {
     window.rivendell.showBannerAd()
    }
    
    function isInterstitialAdLoaded() {
     window.rivendell.isInterstitialAdLoaded(callback => {
     alert("Interstitial loaded: " + JSON.stringify(callback))
     })
    }
    
    function showInterstitialAd() {
     window.rivendell.showInterstitialAd()
    }
    
    function isRewardedAdLoaded() {
     window.rivendell.isRewardedAdLoaded(callback => {
     alert("RewardedAd loaded: " + JSON.stringify(callback))
     })
    }
    
    function showRewardedAd() {
     window.rivendell.showRewardedAd()
    }
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The error in the log indicates that the method is called, so it's fine.

    To build with C3 you need to export your project for Cordova, then unzip the exported game and edit two files - config.json and config.xml

    See how other cordova plugins are configured there and add "cordova-plugin-device" the same way, preserving the correct formatting!

    After that add all files back to ZIP, open Export Manager in C3, load your updated zip there and click "Build application" icon.

    This will only work if cordova-plugin-device plugin is whitelisted in C3, I am not sure if it is.

  • You can just insert the content of this file into a text variable and then execute it with "Browser Execute JS"

    Or add this file to the project, request it with AJAX and then execute.

  • How can I do that Horizontally?

    Change drag&drop behavior to "Horizontal only". And then update all conditions and actions - for example change angle 90 to 0, angle -90 to 180, replace "Set Y" action with "Set X", height expression with width etc.

  • one more question, its possible to make it also in C2?

    Idk, you can try - run the dame script with "Browser Execute JS" action.

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 279 followers

Connect with dop2000

Trophy Case

  • 10-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x14
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

30/44
How to earn trophies