TheCocce Posted November 21, 2015 Share Posted November 21, 2015 Hi all, I have this problem. I have to create a background animation using about 40 jpg. (backgroun1,jpg.....background40.jpg).Each background image is large like a stage, so about 840 px. I tried drawing on BitmapData but the size grows too much. What is the correct way to create a standard animation adding each single frame after loading all images (back1...back40.jpg)? for (var i=0; i< LOOP_FRAME_COUNT; i++){ game.load.image(this.game.loopFrameNames, path + "loop/" + this.game.loopFrameNames);} Thanks in advance. Link to comment Share on other sites More sharing options...
TheCocce Posted November 23, 2015 Author Share Posted November 23, 2015 Any ideas? Link to comment Share on other sites More sharing options...
jmp909 Posted November 23, 2015 Share Posted November 23, 2015 is there no way you can simplify your backgrounds to use reusable elements eg Tiles, TileSprites, repeated symbols etc? 40 full sized images sounds like a lot to be throwing about. when you say animation do you mean the background is static but the frames change? you can try loadTexture but i don't know how fast it will be http://phaser.io/docs/2.4.4/Phaser.Component.LoadTexture.html#loadTexture . does not sound like a good idea Calling this method causes a WebGL texture update, so use sparingly or in low-intensity portions of your game, or if you know the new texture is already on the GPU.have you thought about using video? Link to comment Share on other sites More sharing options...
TheCocce Posted November 23, 2015 Author Share Posted November 23, 2015 Thanks for your answer. I thought Video is not fully supported..... Am I wrong? Link to comment Share on other sites More sharing options...
jmp909 Posted November 23, 2015 Share Posted November 23, 2015 If your targeting mobile I wouldn't be trying to animate that many background images anyway so doesn't really make a difference in that senseWhat are you actually trying to do? Link to comment Share on other sites More sharing options...
TheCocce Posted November 23, 2015 Author Share Posted November 23, 2015 I m writing a little set of casinò game... each game must be played from desktop and mobile too. on win I must play an animation (with viewport size)... So...what is the best solution? Link to comment Share on other sites More sharing options...
jmp909 Posted November 23, 2015 Share Posted November 23, 2015 * have simpler assets for mobile* construct a scene out of smaller moving parts* I think you can safely use a 2048x2048 texture ... that would presumably let you use 32 frames of 512x256 image without having to switch texture on the gpu.* potentially use scanline overlay to compensate for using a lower resolution http://creativebits.org/files/horizontal.gif the best solution depends on your design and target platforms have a look herehttp://www.html5gamedevs.com/topic/6762-max-texture-size-for-webgl/ Link to comment Share on other sites More sharing options...
TheCocce Posted November 23, 2015 Author Share Posted November 23, 2015 Thank you very much! How to use scanline? I have to draw a transparent overlay over the textuxe/animation? Link to comment Share on other sites More sharing options...
jmp909 Posted November 23, 2015 Share Posted November 23, 2015 Or draw it onto graphics and cacheAsBitmap. Or a BitmapData with set pixel/processpixel . Lots of different ways Link to comment Share on other sites More sharing options...
Recommended Posts