Search the Community
Showing results for tags 'keyframe'.
-
I'm following this game example: https://phaser.io/examples/v2/games/starstruck When the character jump to the right or left you can see that the legs are still animated I want to change the animation if the user press up+left / up+right so basically I need to show only one keyframe, I tried something like that: ( see the lines where I set the keyframe to be 1 and another line I set it to be 6 ) I will appreciate your help function update() { // Collide the player and the stars with the platforms var hitPlatform = game.physics.arcade.collide(player, platforms); game.physics.arcade.collide(stars, platforms); // Checks to see if the player overlaps with any of the stars, if he does call the collectStar function game.physics.arcade.overlap(player, stars, collectStar, null, this); // Reset the players velocity (movement) player.body.velocity.x = 0; if (cursors.left.isDown) { // Move to the left player.body.velocity.x = -150; player.animations.play('left'); } else if (cursors.right.isDown) { // Move to the right player.body.velocity.x = 150; player.animations.play('right'); } else if (cursors.left.isDown && cursors.up.isDown) { player.frame = 1; } else if (cursors.right.isDown && cursors.up.isDown) { player.frame = 6; } else { // Stand still player.animations.stop(); player.frame = 4; } // Allow the player to jump if they are touching the ground. if (cursors.up.isDown && player.body.touching.down && hitPlatform) { player.body.velocity.y = -300; } }
-
So, first of all, I am new to Phaser, but I work as a programmer. I have some knowledge about how 3D modelling tools work , even for animation. I am wondering if someone can give me more info about this. What i've got: a bunch of static images ( no spritesheets, no texture maps, only static images) My question is: Is there any way to program like keyframes (like blender3d) in order to specify position, scale and rotation to the elements i want on the screen , also layering and something like opacity? Is there any way people have done this with particle effects? How would you proceed about this? I am open minded and ready to try anything, I need to deliver this ( the game is almost done , all it misses is 2 animations at the end, I didn't build the game, my coworker did, but he has quit the company to have more time for univeristy)
-
Hi guys, I have another little problem. Unfortunately I can't share too much code, but i 'll try to synthesize. I have a park with 7,8 animals, all animals have plenty animations like, from key 0 to 100 - walk animation, 110-180- run, etc. When I load all animals, I try to start for each of them one animation, random from the entire film. But animation start only for 3 or 4, when one is finished, start another animation, and so on, but after a few time the animations stop at a time. And the others animals nothing do. If i refresh the page, 3 other animals will be animated, and the others nothing, and so on. I test the animations foreach individual animals, and works fine, but when I import more than 3 or 4 diferent animals the animation not start at all. And all animals have the same skeleton. And I can't explain why. And a piece of code: BABYLON.SceneLoader.ImportMesh("",url,"lion.babylon", scene, function (m, p, s) { m[0].active_animation = 1; m[0].skeleton = s[0]; var on_end = function(){ //stop actual animation scene.stopAnimation(m[0].skeleton, setting[m[0].active_animation].from, setting[m[0].active_animation].to, false,1); //choose one animation random from film m[0].active_animation = parseInt((Math.random() * 10) + 1); //start new animation scene.beginAnimation(m[0].skeleton, setting[m[0].active_animation].from, setting[m[0].active_animation].to, false,1,on_end); } scene.beginAnimation(m[0].skeleton, setting[m[0].active_animation].from, setting[m[0].active_animation].to, false,1,on_end);});Thanks a lot, and sorry my bad english.
- 5 replies
-
- animations
- keyframe
-
(and 1 more)
Tagged with: