Issue drawing images on load

0 favourites
  • 8 posts
From the Asset Store
You need this package if you want to program a Street Fighter or battle game.
  • Problem Description

    On load, images are always displayed at axis 0,0. Line of concern is ctx.drawImage(frameimg, 0, 0). We are using a number of images, including sprites with filled color, they appear squashed in the upper left and hand corner not long before being laid out correctly.

    Temp solution: for each runtime we could update the script to show images off the stage by setting points to -6000.

    However, the option we have gone with until this can be resolved is: add a function on load complete that calls an external JS function that lets canvas know construct is ready, e.g. set canvas style to display:block.

    Also note: we are also calling web services to get JSON data.

    Observed Result

    Image mash up, axis points 0,0

    Expected Result

    No image mash up.

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (YES)

    Operating System and Service Pack

    Windows 7 Service Pack 1

    Construct 2 Version ID

    Release 163

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Closing, please follow the bug report guidelines. I do not see this problem and I have no way of reproducing what you've reported because you didn't describe what you are doing.

  • Hi Ashley, I've read the guidelines BUT this is not about the capx file or anything in it, its in regards to the runtime.js that is created. Regardless of capx file supplied, ALL images are set at axis 0,0 on canvas. Images aren't laid out correctly until events are able to be reached, so for a large game with lots of images. You may get this issue, I think the difference for us is that we are also relying on web services after load AND this may also be creating loading issues, however, regardless the problem still points to how images are being added in the canvas. And creating a good preloader for Construct2 games, e.g. how you would develop a preloader for Adobe Flash Games. Are all assets ready? Show game.

  • I never see that in any .capx, nor have I ever heard any other users reporting the same issue. Without a way to reproduce the problem there is nothing we can do about it. But it sounds specific to your computer only. Does it happen on any other computers? Are your graphics card drivers up to date?

  • Works fine on Chrome. Just FireFox is the problem.

    I should have also mentioned that this is no ordinary game. We're developing a full featured multimedia educational game. Videos, web services, loading in JSON data etc.. a lot going on. Probably if we strip it back we could eventually determine where it might be getting a hold up. But we're days from launching now, so will keep going with our wrapping preloader option.

    I think typically games load reasonably fast, you might not notice images being laid out to their x and y axis points, but something in our game creates the delay where images are still 0,0, at least for 0.5 milliseconds.

    Can't upload a capx file as its not personal development.

  • Ashley It only occurs when not using webgl. In the sprite plugin it has the function "preloadCanvas2D" that draws all the animation images to the canvas on load. You can see it in any project if you set "Enable WebGL" to off, "Clear Background" to no and make the bottom layer transparent. So when the load is quick you will never see them since it will be overdrawn.

  • Correct. We are not using webgl.

  • Another problem and also related is the FireFox NS Error issue. I think this and the above could be the same problem. FireFox NS Error is the Canvas drawImage, sometimes works, sometimes doesn't. We've updated the Construct2 Sprite runtime.js to include try catch and also reload if there is an err. Also seems to be a recommended approach for those trying to work around the FireFox NS Error issue.

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