Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anim not found #637

Open
LUIS9799 opened this issue Sep 26, 2022 · 4 comments
Open

Anim not found #637

LUIS9799 opened this issue Sep 26, 2022 · 4 comments

Comments

@LUIS9799
Copy link

Version

latest

What browsers are you seeing the problem on?

Chrome, Microsoft Edge, Other

What happened?

So.. i'm recieving this error recently when i added an animation to main character, it can be noticed that i have other animation in a portal (platformer kaboom game) and it works perfect, it only happen when entering to game, however in a couple of refreshes you can actually see that game works as expected

yes.mp4

this is a video showing it, also i call loadsprite after scene
i though that is was the network, so i tired to test it in a corporative network, but there is the same error..
then i tried to move loadsprite after imports, but it does not work
i even change the server to a powerful one but it wasn't the server
i tried to call assets in same main file but it gives me other error...
i tried to get support on kaboom's server but all methods failed..
finally Danie told me to create an issue in github for review, Is it possible to developers to get a quick fix? i really need that this issue gets fixed
This is all, i attached a test server on replit in order to show the bug, as i said you need a couple of refreshes to let the game work.
Thanks

What's the expected behavior?

This should load game correctly without any errors regarding anims.

Minimum reproducable code

loadSprite("player", "/sprites/sheet.png", {

	sliceX: 9,

	anims: {
		"idle": {
      

			from: 0,
			to: 3,

			speed: 3,
			loop: true,
		},
		"run": {
			from: 4,
			to: 7,
			speed: 10,
			loop: true,
		},

		"jump": 8
	},
})
player.onGround(() => {
	if (!isKeyDown("left") && !isKeyDown("right")) {
		player.play("idle")
	} else {
		player.play("run")
	}
})

player.onAnimEnd("idle", () => {

})

onKeyPress("space", () => {
	if (player.isGrounded()) {
		player.jump(JUMP_FORCE)
    player.biggify(3)
		player.play("jump")
	}
})
	
	onKeyPress("up", () => {
	if (player.isGrounded()) {
		player.jump(JUMP_FORCE)
    player.biggify(4)
		player.play("jump")
	}
})

onKeyDown("left", () => {
	player.move(-MOVE_SPEED, 0)
	player.flipX(true)
  player.biggify(5)
	if (player.isGrounded() && player.curAnim() !== "run") {
		player.play("run")
	}
})

onKeyDown("right", () => {
	player.move(MOVE_SPEED, 0)
	player.flipX(false)
  player.biggify(5)
	if (player.isGrounded() && player.curAnim() !== "run") {
		player.play("run")
	}
})

onKeyRelease(["left", "right"], () => {
	if (player.isGrounded() && !isKeyDown("left") && !isKeyDown("right")) {
		player.play("idle")
	}
})

Live demo

https://pegesourcemain-3.luiscraftyt3.repl.co/jugar

@LUIS9799
Copy link
Author

LUIS9799 commented Oct 1, 2022

Any answer?

@slmjkdbtl
Copy link
Contributor

slmjkdbtl commented Oct 4, 2022

Sorry I didn't understand the problem, the video doesn't seem to show an error and the link doesn't show an error. Did you get the "Anim not found: (anim name)" error message when trying to call play()?

@LUIS9799
Copy link
Author

Yes, it shows (anim error) and the anim, normally is a random anim, the issue was partially fixed, but in some cases you can see the error, i think that's why you didn't see any errors, try again

@magical-heyrovsky
Copy link

This is not "Minimum reproducable code". If you still want help provide a link to the repository or fix the code in your first comment (where do you define the player component? where do I find the sprite? Etc...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants