Spax's Recent Forum Activity

  • Okay.

    Thx for clarification. I guessed it, that you can´t call a Sprite. Anyways. You can get around, by using functions ! I just thought to "directly" use JS-code to manipulate a Sprite.

    2.) Ah ok, guessed it too. As we can include as many *.js files into our scene, as we want, is it clever to to put all your logic into "one" *.js, or can you use different *.js for different tasks ? Like : "run.js", "camera.js", etc ...

    Manual / API:

    "...What else do you want it to cover? ...". All the commands for an external-JS isn´t on the link you provide. F.E. i can´t find anything like this "c2_callFunction(func_name, args_array);" in the so called "documentation"-link. There are just 2x-3x "small bitmap-pics" that barely describe some stuff. Thats all. There is 1x example.capx, i think. But its not done in different example.capx files, what would be much better, imho.

    I also don´t get it, if you wrote something like "func_name, args_array". Therefore i need "real_names" in an explaination, that refer to a other "real_name" and so on. Maybe you can take a look at some other API-documentations of other GameEngines.

    I only found important stuff in this forum here. Just wantet to give positive-critic. I am not a super power user in "JavaScript" ! Just learning it. And yeah, its maybe not that important for you, if you don´t want to reach many users, etc. Can understand it.

  • Hey, this is a really great plugin !

    I managed to got it working with variables / floats. So importing my *.js file into the scene works ! I just got some questions:

    1.) Can i command directly a "Sprite" inside C2, named "sprite_test" , by my outside "test.js"-file ? If yes, what is the command for it ? I didn´t found any info about it.

    2.) Does an external *.js have an impact to the whole performance of the game ?? I was just thinking about the communication of variables from extern JS to C2 and vise versa, that it could slow down the information flow.

    And last but not least: it wasn´t easy to get info about API / commands for the extern JS / and intern C2 commands. All i found was in this thread here. Therefore i would recommend to the devs, to make a kind of API link onto their website (with a search function & examples)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am not sure if i understood everything. But yeah, thats right...they block it. But it is possible, to play without user input (w. the code i shared above). I tried it on different mobile-browsers (Android).

    So...you say it is allready possible by the construct2-intern-Audio Plugin?

    I didn´t expirienced that, sadly. It would be great if you can provide a link + a sample.capx , so i can see how its done internaly by C2.

  • Wow !!!

    What a usefull plugin !!!

  • There is also a possible solution to play sound without user-input with the plugin "ToneJS" which is provided by "RexRainbow". It works as expected.

    But it wasn´t that easy to figure out, how to use it. Therefore i will share an example-file with you : https://mega.nz/#!Yglh2apY!Q2mkQuItenkUsHoZR7PaCVSbC7gigT6CQ--PI3gm5Vk

    EDIT (info to the Moderator of this forum):

    My previous post didn´t went through. So it was a test / junk and can be deleted !

  • So happy...

    ...I was able to solve my Prob 1.) "closing the app"

    Because it didn´t worked by Plugins and C2 closing mechanisms. Than i found out, that you can use this command :

    CocoonJS - EXIT app (via Browser-Execute-Javascript):

    -----------------------------------------------------

    Cocoon.App.exit();
    navigator.app.exitApp();
    

    (you just need one of them. All two works)

  • By the way ... this is the Script i used :

    var URL_1 = "media/music_menu.m4a";
    var buffer_1; // important
    var audioCtx_1 = new (window.AudioContext || window.webkitAudioContext)(); // maximum 6x are allowed
    var xhr_1 = new XMLHttpRequest();
    // -----------------------------------------------------------------------
     xhr_1.open('GET',URL_1, true);
     xhr_1.responseType = 'arraybuffer';
     xhr_1.onload = function() { audioCtx_1.decodeAudioData(xhr_1.response, onBufferLoad_1);
     }; xhr_1.send();
    		
    function playBeginning_1() {
     source_1 = audioCtx_1.createBufferSource();
     source_1.connect(audioCtx_1.destination);
     source_1.buffer = buffer_1; // important
    	source_1.loop = true; // true, false
     source_1.start(0);
    };
    
    function onBufferLoad_1(b) {
     buffer_1 = b; // important
     playBeginning_1(); // plays imidiantly, after loaded
     //source_1.stop(0); // prevent direct play & enabels direct trigger
    };
    // -----------------------------------------------------------------
    play_1_snd = function() { // Music - MENU
    playBeginning_1();
    }
    
    stop_1_snd = function() {
    source_1.stop(0);
    }
    

    Maybe it can be useful for someone else ....

  • Oh really ?

    Thats great ! But somehow it didn´t worked for me. Maybe i did something wrong?

    I used the "Audio"-item and later on, in the commandsheet i tell the object to "play" the specific file (*.ogg / *.m4a). Usually if the user do his input, it plays. And strangly with a delay... No idea why.

    But also when the "next" Level starts, it should play sound without user input. This didn´t worked. "..Browsers mute audio until the first user input... " <- with my script you really don´t need input. It starts playing sound without any input. Just type the webAdress and it goes on.

    I have C2 r265

    Android 5.1 , newest chrome

    Android 8.1 , newest chrome

    Is there any Tut. about this topic? Or any example files, i can learn form ? I did a search in the formus after "sound mobile" / "delay mobile", etc. But didn´t find any thread about this. (On Desktop for instance, everything runs like a charm).

    I have to mention, that the C2-Engine on mobile is pretty damn fast ! Almost faster as many other HTML5 Engines! And you can run stuff really good as "Web App". Just now ...i am a bit struggleing & i hope to find a good way, with the audio play on mobile with C2

  • I discovered some limitations on mobile. So i wasnt sure what & why exactly. But gladly i found a small-"mention" in the construct2 documentation :

    scirra.com/manual/109/audio (check the Header "Mobile Limitation")

    Than i was serching for a workaround. And i found something interestant. You can achieve audio playback without "user interaction / input". And it works ! (on Android. On iPhone it doesn´t work)

    The workaround is called: "AudioContext"

    ( developer.mozilla.org/en-US/docs/Web/API/AudioContext )

    I was able to handle this with construct 2 and "extern" JS-script. Thanks to a C2 plugin called "ValerypopovJS". It is just nasty to do something by hand. What i also found out, is:

    1.) On 6y old devices i got a sound-Delays

    My guess is, that i cames from the "communication" of C2 to external JS-script. What do you think? Could something like this use too much power of the CPU ?

    Some questions about this topic:

    2.) Is there any plugin out there, which handles this problem in a elegant way ?

    3.) If not, would it be a big deal, if someone could write one ?

    4.) Would it be more performant, to put the AudioContext-JS script inside the C2 sheetboard, instead into an external JS-file ?

    5.) Does anybody else expirienced also the same behaviour on mobile-devices ? And what workarounds did you used ?

  • Okay ... something like this is achieveable ;-)

  • Okay ... got it

  • Oh okay. But what is the alternative ? Or what is the better solution ?

    I allready tried the regular export = cordova (used cordova CLI). It gives an APK output which is around 3mb big. It also works, but it has semi-good performance on many phones i tested. You would think: ...nice. Its smaller than cocoon.io. Yes it is. BUUUUT ... as said, it isn´t performant as cocoon.io is!

    I hope you can help us, finding the best export-process (performance wise) / best APK wrapper, etc.

    EDIT:

    What was the reason moving away from cocoon.io ?

Spax's avatar

Spax

Member since 9 May, 2014

None one is following Spax yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies