Growler Posted October 17, 2018 Share Posted October 17, 2018 @obiot @Parasyte In Melon JS 5.1, in the Draw function, I'm getting error: Uncaught TypeError: Cannot read property 'x' of undefined I'm packing the animations in texture packer and have no issues with any other animations. Error is shown below in your engine's code: renderer.drawImage( this.image, g_offset.x + frame_offset.x, // sx <-- ERROR HERE g_offset.y + frame_offset.y, // sy w, h, // sw,sh xpos, ypos, // dx,dy w, h // dw,dh ); Here is an image of the working animation with all of its properties: https://imgur.com/y0IUOTo Here's an image of the problematic animation: https://imgur.com/hb5ygey Just above, I put an if/else block with logs, and it happens with name: "talk" animation var w = frame.width, h = frame.height; if (!frame.offset) { console.log('Does not have offset: ', frame); } else { console.log('Has offset: ', frame); } I then decided to check the texture map file: game.texture = new me.video.renderer.Texture( me.loader.getJSON('texture'), me.loader.getImage('texture') ); console.log('GAME TEXTURE: ', game.texture); And I see all of my expected animations with their respective offset properties: https://imgur.com/19Ta2gd I did notice, however, that one of the coordinate mappings is missing two objects: there should be "el driver/talk/el driver00.png", "el driver/talk/el driver01.png" and "el driver/talk/el driver08.png when it should be assets el driver00 through el driver12. This could be the issue as it may be looking for and creating a new object without all of its properties? https://imgur.com/Hgwr6AR ----------------- EDIT: I see this was discussed four years ago (https://groups.google.com/forum/#!topic/melonjs/4AMMxsfPryE), I assume this is not relevant now as entity does not require explicitly passing in spritewidth and spriteheight. Quote Link to comment Share on other sites More sharing options...
Growler Posted October 17, 2018 Author Share Posted October 17, 2018 Figured it out! There was a problem loading a couple animation strings. Quote Link to comment Share on other sites More sharing options...
obiot Posted October 17, 2018 Share Posted October 17, 2018 oh ok good you did then ! what exactly was the issue ? (I fail to see how it was triggering the above exception) Else you should really upgrade to at least 6.1 (6.2 is not yet publicly released), tons of improvements since 5.1 https://github.com/melonjs/melonJS/blob/master/CHANGELOG and except for the utils.xxxx functions, there are no major breaking changes https://github.com/melonjs/melonJS/wiki/Upgrade-Guide Quote Link to comment Share on other sites More sharing options...
Growler Posted November 2, 2018 Author Share Posted November 2, 2018 nvm got it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.