frame has no offset property

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:

                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:

Here's an image of the problematic animation:

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

		console.log('GAME TEXTURE: ', game.texture);

And I see all of my expected animations with their respective offset properties:

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?


EDIT: I see this was discussed four years ago (!topic/melonjs/4AMMxsfPryE), I assume this is not relevant now as entity does not require explicitly passing in spritewidth and spriteheight.

Share this post

Link to post
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

and except for the utils.xxxx functions, there are no major breaking changes


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.