0plus1's Forum Posts

  • Pode, there is an issue with your pluging, read here apparently the injected sprite is missing width and height?

    If you can help me fix this error I'm more than willing to pay you for your work.

  • It's very strange, the plugin is a behaviour that is doing this:

    this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.src = '';

              this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.src = base64string;

              this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.onload = (function (self) {

                  ?return function(info) {

                        cr.runtime.redraw = true;

                  ?};

              })(this);

    where base64string is the url of the image. The line that throws this error is just this one: this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.src = base64string; even deleting all the rest it still throws that error.

    All the browser do not, only android 2.2 and iOS 4.X

    It seems strange, but maybe you have an idea about the reason this might happen and how to mitigate it, is there any other way except .src to load an image inside a sprite?

    Thanks

    Edit: Ashley sorry to bother you about this but you are the only one that can point me in the right direction

  • Ashley thanks for your help. But something else is wrong here. I wrapped your code to check:

    if(this.height>0&&this.width>0){

                        ctx.drawImage(cur_image,

                                   myx,

                                   myy,

                                   this.width,

                                   this.height);

                   }

    And it throws the same error here: this.height.

    Why do you think this is happening?

  • Maybe it's not the right direction, but probably Ashley knows what we are talking about.

    On iOS4 (not 5)and Android too, this plugin (inject)make the entire canvas hang completely. Xcode do not show anything (because it do not have a js debugger) instead LogCat in Eclipse fires this:

    INDEX_SIZE_ERR: DOM Exception 1: Index or size was negative, or greater than the allowed value.

    The incriminating line is this one: ctx.drawImage(cur_image, myx, myy, this.width, this.height);

    Any idea why and how to fix it?

  • Thanks, if you point me in the right direction maybe I can do it myself otherwise let me know when you are ready, it's the last piece missing from my application.

  • I love you.

    Disregard what I said and please sticky his solutions because it's a life saver!

  • This should be sticky, I wish I'd seen it before..

    Why are you setting this: "(LayoutHeight * scaleRatio - WindowHeight) / 2 / scaleRatio" technically the result would always be 0? Or am I missing something?

    EDIT: Also how is it that the element in your canvas stay magically centered?

    EDIT2: Disregard that I'm stupid, I didn't see the unbounded scrolling

  • Speaking of mobile, the first issue are the different resolutions, and more specifically in c2 the real issue is the aspect ratio.

    Now I understand that the support of different aspect ratio is not easy, but currently c2 is handling this issue very poorly.

    My journey started in this thread that made me also ask on stack overflow (sorry for my lack of mentioning of c2 but I didn't want the question to get dismissed as "game maker").

    Basically you can't resize the c2 canvas with certainty, the only way is to create an anchor behaviour and then get the size of the stretched sprite because the c2 canvas DO NOT match the windowsize (I think this is for the scaling) in any case doing it with this hack creates all sort of problems which are unpredictable (and that resulted in errors in iOS4.3 and android 2.2).

    Currently in c2 it is not possible to support different aspect ratios, we have to rely on scaling and subsequents horrible whitespaces (which on android are unprofessional, on iOS are immediate ground for rejection) or on building for different resolutions, which by the way is a real nightmare on an interface like c2 where you can't access the code.

    I would like to hear:

    1) Ashley what is your position on this issue and what could we do to mitigate this and what are the consequences of stretching a sprite with anchor and then position elements relative to its position (one of them is for sure the onload event not firing anymore on sprites and this error).

    2) The guys who published on android (@ranma) what did you do for the ratio issues? Did you scale and left the blank space or found other solutions?

    Thanks

    EDIT: A possible solution would be the one corona is implementing. Basically is the same as scale mode but binded to the center. C2 Instead binds the canvas to the top-left corner. If we could have it in the exact center we may create "bleed" graphics like bigger background that do not show normally but only on bigger devices (see the corona link).

  • Pode, don't worry about that because it's probably an issue with the simulator.

    Instead, your plugin on both android/iphone when the aspect ration changes from the original one it fires an error in this line of the engine:

    ctx.drawImage(cur_image, myx, myy, this.width, this.height);

    do you have any idea of why?

  • Ashley after testing it looks like a bug of the simulator but I'm not completely sure.

  • How can I make a plugin that simulates a touch event every thick at a determined coordinate?

  • Ashley

    Apparently that is not the problem, even a blinking object on top doesn't work, it's a problem here:

    this.imageObj.onload = (function (self) {

    this never fires, not until i keep on touching the screen (not one not two,but two/three in rapid sequence) do you have any idea on why this happens? Apparently only on iPad this happens.

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    for reasons that I do not understand, both the inject and the loadfromURL plugin do not work on the iPad until something makes sprite refresh.

    To clarify:

    1) Creating a non-transparent sprite bigger than the inject/load sprite on top of it then destroying it triggers the loading/injecting

    2) Touching the sprite several time after 2-3 seconds loads/injects the new image

    This leads me to think that the problem lies in the refreshing of the canvas but executing this command:

    this.runtime.redraw = true;

    doesn't change anything, do you guys can point me in the right direction?

    Thank you

  • Pode I found the culprit for reasons unknown this never fires:

    this.inst.cur_animation.frames[this.inst.cur_frame].texture_img.onload

    until the user touch the screen (and even then is unpredictable) do you know why? Is there any way to forse the loading?

  • Ashley sadly the tickcount doesn't reset each layout so after the first one, I need a solution that resets each layout.