Jump to content

frame has no offset property


Growler
 Share

Recommended Posts

@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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • 3 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...