hassiba's Forum Posts

  • hassiba and rexrainbow can you please edit the "canvas" plugin and post to dropbox and share the link so those who are getting a black screen error (like me) can be assisted once and for all.

    I actually believe in this edited plugin of yours

    Hi

    It has been over 3 years, can not remember a thing

    but I found some notes, this is what I have, I hope it helps:

    Canvas edittime.js:

    AddStringParam("filename", "enter file name", "myfile.png");
    AddAction(44, 0, "savetofile", "Canvas", "savetofile", "savetofile", "savetofile");[/code:2pgq000y]
    
    Canvas runtime.js:
    [code:2pgq000y]acts.savetofile= function(myfile)
    {
    var imageData = this.canvas.toDataURL().replace(/data:image\/png;base64,/,'');
    cordova.exec(null, null, "Canvas2ImagePlugin","saveImageDataToLibrary",[imageData]);
    };[/code:2pgq000y]
  • Arne

    These are instance variables in an object.

    I did debug the issue as Ashly suggested. and I have noticed the following:

    in Intel XDK emulator, the instance variable name lookup to get the index number fails. while it works perfectly fine in browser.

    those instance variables are zero indexed by the same order when first created in C2. hence if I access them by index number I have no issue, even in XDK.

  • rexrainbow

    may be i used the wrong term in describing the problem.

    what I meant is the assigned variable to a sprite object. this is what I am trying to read in my behavior

    yes, they are stored in two arrays, one for variable names, and one for variable value.

    like this:

     var retvar;
             for(var instVarNameIndex in instVarNames)
             {
                if(instVarNames[instVarNameIndex] == varStr) // <== this does not seem to find a match in XDK emulator, but works in browser
                {
                   varIndex = instVarNameIndex;
                   retvar = inst_only.instance_vars[varIndex];
                   
                }
             }[/code:v5f274gf]
  • I am having issues in reading objects local variable in plugins.

    even without the minifier, parsing a variable name in plugin to fetch the value is not working.

    is the exporter braking it? because it is working fine in browser.

  • Hi again

    could someone please help me. the code for parsing the object variables is only working in browser but not in Android Cordova emulator on intel XDK nor on actual android mobiles!

    could someone please have a look:

    		this.inst.update_bbox();
    
    		var inst_only = object.getCurrentSol().getObjects();
    		inst_only = inst_only[0];
    		
    			var varStr = "MyVariable";
    			var instIndex = 0;
    			var varIndex = -1;
    			var inst_only = object.getCurrentSol().getObjects();
    			inst_only = inst_only[0];
    			var instVarNames = inst_only.instance_var_names;
    			
    			var retvar;
    			for(var instVarNameIndex in instVarNames)
    			{
    			   if(instVarNames[instVarNameIndex] == varStr)
    			   {
    				   varIndex = instVarNameIndex;
    				   retvar = inst_only.instance_vars[varIndex];
    				   
    			   }
    			}[/code:2je6bcka]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I got the answer, from a similar thread:

    var instIndex = 0;
    var varStr = 'text2';//made up instance variable added in the editor
    var varIndex = -1;
    var inst = this.type.instances[instIndex];
    var instVarNames = inst.instance_var_names;
    for(var instVarNameIndex in instVarNames)
    {
       if(instVarNames[instVarNameIndex] == varStr)
       {
           varIndex = instVarNameIndex;
       }
    }
    var instVarValue = inst.instance_vars[varIndex];[/code:i5d6xxj2]
    
    will report back if it works
    
    EDIT:
    confirmed, and it is best used in a separate call function
  • Hi

    I have made a behaviour where I am parsing an object as a variable.

    This object has many instance variables that I need to read in my script

    I tried to read the instance variables as if they were x,y,opacity variables ...etc, but it is not working.

    This is what I am trying:

    Acts.prototype.MyFunction= function (object_){
    
          var inst_only = object_.getCurrentSol().getObjects();
          inst_only = inst_only[0];
          console.log(inst_only.x); // it is working, I can see my x position in console
          console.log(inst_only.MyInstanceVariable); //NOT working, giving me undefined.
          ...[/code:28unziqc]
    
    I am stuck with my project at this stage, your help is highly appreciated.
    
    thanks
  • Do sub-events always run in serial (top-down) and wait for each other to finish in the same order?

    i.e, do bottom sub-event wait for top sub-event to finish

    example

    main even( condition1 )

    sub-event1( condition 1.1 )

    sub-event2( condition 1.2 )

    sub-event3( no-condition - only action)

    if sub-event2 condition is met and its actions are CPU hungry, will sub-event3 run before sub-event2 finishes or wait for it?

  • Your capx is a zip file.

    If you uncompress it and open the .caproj file you can edit the "<saved-with-version>" tag.

    If you haven't used any specific r185 feature, this should do the trick.

    For the license you can ask a refund from Steam and use the money to buy it from Scirra's store's on the website here.

    you are a life saver, thanks a lot man

    <saved-with-version>18500</saved-with-version> did the trick

    Regarding steam refund, I have had C2 with them for around +6 months, I do not think it is an option

  • Hi Ashley

    I have a personal license on C2 in steam. it was set to download latest beta.

    My game is in development for the past 2.5 months, last version of C2 I was working on last night was 185

    apparently, the last beta 186 broke my game, downgrading to 184 is not working either, it says the game was made in a newer version (185)

    there is no method in steam to get back to beta 185.

    please help?

    one more thing, I regret buying C2 personal license from steam for obvious reasons, is there anyway to convert it or detach it from steam?

  • Getting the same message, then this:

    Assertion failure: Unknown parameter type: undefinedStack trace: Error at Error (native) at assert2 (http://localhost:50000/preview_prelude.js:16:10) at new Parameter (http://localhost:50000/eveng.js:1981:47) at new Condition (http://localhost:50000/eveng.js:1192:17) at new EventBlock (http://localhost:50000/eveng.js:555:14) at EventSheet.init_event (http://localhost:50000/eveng.js:117:16) at new EventSheet (http://localhost:50000/eveng.js:103:9) at Runtime.load (http://localhost:50000/preview.js:1380:16) at new Runtime (http://localhost:50000/preview.js:317:8) at Object.cr.createRuntime (http://localhost:50000/preview.js:5367:10)Subsequent failures will now be logged to the console.

    I am so stuck, and rolling back is not working either

    what was the previous version 185 beta?, I need it. how to download it plz

    my project can not run on 184 and it is bugged in 186

    EDIT:

    Kyatric gave me the solution, edit your project file with 185 version instead of 184

    <saved-with-version>18500</saved-with-version>

  • Crashes (as in the app exits) are usually caused by buggy graphics drivers, or running out of memory. In rare cases it may be a browser bug, but the first two causes are far more likely. There's not much you can do about buggy drivers; most mobile platforms don't allow updates outside of updating the entire OS, which is subject to the carrier/manufacturer approving the update.

    If there's a bug in the C2 engine then if the JS code goes wrong it probably won't crash the app. It will probably freeze instead, since the browser engine catches the JS error, halts the script, and then continues running the page. That's useful in web pages but since the C2 engine is all JS then the game logic halts freezing the game then the last frame remains on-screen. If that happens then ideally you'd be able to reproduce it and report it as a bug to us so we can fix it.

    Thank you, this makes a lot of sense.

    I am aggressively using the Canvas plugin and there is no comparison between PC graphics driver vs mobile.

    although I am streamlining the Canvas update to be every 1/60 seconds

    May be I need to do more work to prevent overlapping of the same events that work on the canvas. by setting and clearing a flag at the beginning and end of the event.

  • Hi

    I am puzzled, my game on PC never crashes, but it does occasionally when porting it to mobile (crosswalk).

    from your experience, what is the best approach to track down what is causing the crash?

    is there a way to at least tell which event it was on before the crash?

    thanks

  • hassiba

    Phonegap RateApp (crosswalk, phonegap) and RateApp (HTML5 website) are released.

    Thanks for your suggestion, again.

    you are awesome, thanks a lot

  • R0J0hound

    I need to extend your Canvas plugin with a new behaviour

    Do you know how to access "this.canvas and this.ctx" from a behaviour?

    EDIT:

    Got it, from rex's canvas_ext

    var self = this;

    var inst = self.inst;

    var canvas = inst.canvas;

    var ctx = inst.ctx;