Jump to content

Search the Community

Showing results for tags 'behavior'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 8 results

  1. Looking at the camera bouncing behaviour documentation PG example https://www.babylonjs-playground.com/#6FBD14 I can't notice any bouncing effect at all. Is it just really subtle or isn't it working?
  2. Hi guys, this is my first topic in this amazing community, so I would be glad if you can enlighten my doubts as a nice welcome :). I'm programming a survival horror game, and everything is working great except when it comes to colliding among two or three objects. I can't describe the behavior properly because for example: If the main character collides a barrel for example, it works great but It doesn't happen the same when an enemy is moving randomly and suddenly rans into a barrel, because it's like there is no barrel, the enemy just goes through. Here is the index.html file so that you can help me out on this, it's not a large code at all, it's very simple but it's driving me crazy until now. <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>Rescate</title> <script type="text/javascript" src="js/libs/phaser/phaser.min.js"></script> <style type="text/css"> body { margin: 0; } </style> </head> <body> <script type="text/javascript"> //---------------------------------------------------------------------------------------------------------------- //Crea la pantalla principal del juego var game = new Phaser.Game(640,480, Phaser.AUTO, '', { preload: preload, create: create, update: update }); //Cargo fondo, pisos, estrellas y personaje function preload() { game.load.image('fondo', 'assets/MAPA.png'); game.load.image('ground', 'assets/platform.png'); game.load.image('barril','assets/barril.png',30,40); game.load.spritesheet('dude', 'assets/personaje.png', 64, 64); game.load.spritesheet('mummy', 'assets/momia37x45.png', 37, 45, 18); } //---------------------------------------------------------------------------------------------------------------- var player; var platforms; var cursors; var stars; var fondo; var fondo_movil; var score = 0; var scoreText; var background=1; //PARA LA MOMIA var mummy; var anim; var last_direction=9; //Variables para la animacion de la momia var barril,barril2, barril3; //---------------------------------------------------------------------------------------------------------------- function create() { //Se activa la fisica para el juego de tipo ARCADE game.physics.startSystem(Phaser.Physics.ARCADE); //Fondo para el juego fondo_movil = game.add.tileSprite(0,0,640,480,'fondo'); //plataformas donde se para el personaje platforms = game.add.group(); //se activa la fisica para cualquier objeto creado en este grupo platforms.enableBody = true; //Se crea el piso var ground = platforms.create(0, game.world.height - 2, 'ground'); //Escalado ground.scale.setTo(2, 2); //Esto impide caer al piso cuando el personaje lo pisa ground.body.immovable = true; // El jugador y sus caracteristicas player = game.add.sprite(32, game.world.height - 150, 'dude'); //Se habilita la fisica al jugador game.physics.arcade.enable(player); //Creo el enemigo (momia) mummy = game.add.sprite(380, 400, 'mummy', 5); mummy.scale.set(1.5 ); mummy.smoothed = false; mummy.enableBody = true; game.physics.arcade.enable(mummy); mummy.body.collideWorldBounds = false; barril = game.add.tileSprite(490,430,30,40,'barril'); barril.enableBody = true; game.physics.arcade.enable(barril); barril.body.immovable = true; barril2 = game.add.tileSprite(300,430,30,40,'barril'); barril2.enableBody = true; game.physics.arcade.enable(barril2); barril2.body.immovable = true; //Propiedades físicas del jugador. Se le da al jugador un pequeño rebote. player.body.bounce.y = 0.2; player.body.gravity.y = 400; player.body.collideWorldBounds = true; player.smoothed = true; //Las dos animaciones, caminando a la izquierda y a la derecha player.animations.add('left', [0, 1, 2, 3,4,5,6,7,8], 10, true); player.animations.add('right', [10,11,12,13,14,15,16,17,18], 10, true); //El puntaje scoreText = game.add.text(16, 16, 'Puntos 0', { fontSize: '32px', fill: '#000' }); //Nuestros controles cursors = game.input.keyboard.createCursorKeys(); anim = mummy.animations.add('walk'); anim.onStart.add(animationStarted, this); anim.onLoop.add(animationLooped, this); anim.play(10, true); } //---------------------------------------------------------------------------------------------------------------- function update() { mummy.position.x -= 1; //Colision del jugador con la plataforma y otras cosas game.physics.arcade.collide(player,mummy); game.physics.arcade.collide(player,barril); game.physics.arcade.collide(player,barril2); game.physics.arcade.collide(player,platforms); game.physics.arcade.collide(mummy,barril); game.physics.arcade.collide(mummy,barril2); game.physics.arcade.collide(mummy,platforms); // Resetea la velocidad a cero player.body.velocity.x = 0; // Movimiento de la momia. //Si el cursor izquierdo esta presionado if (cursors.left.isDown) { //fondo movil derecha if(player.x < 0.3 *game.world.width){ fondo_movil.tilePosition.x += background; barril.position.x += background ; barril2.position.x += background ; if(player.x < 0.2 *game.world.width){ player.x = 0.2 *game.world.width; } } // Moverse a la izquierda player.body.velocity.x = -90; last_direction=0; player.animations.play('left'); } //Si el cursor derecho esta presionado else if (cursors.right.isDown) { //Moverse a la derecha player.body.velocity.x = 90; player.animations.play('right'); //fondo movil derecha if(player.x > 0.5 *game.world.width){ fondo_movil.tilePosition.x += -background; barril.position.x -= background ; barril2.position.x -= background ; if(player.x > 0.8 *game.world.width){ player.x = 0.8 *game.world.width; } } last_direction=9; } else { //Sino mantenerse quieto player.animations.stop(); player.frame = last_direction; } // Permite al jugador saltar si este esta tocando el piso if (cursors.up.isDown && player.body.touching.down) { player.body.velocity.y = - 250; } } //---------------------------------------------------------------------------------------------------------------- //Animacion de la momia function animationStarted(sprite, animation) { /* game.physics.arcade.collide(player, platforms); game.physics.arcade.collide(mummy, platforms); game.physics.arcade.collide(player,barril); game.physics.arcade.collide(player,barril2); game.physics.arcade.collide(player,mummy); */ //game.add.text(32, 32, 'Animation started', { fill: 'white' }); } function animationLooped(sprite, animation) { /*if (animation.loopCount === 1) { loopText = game.add.text(32, 64, 'Animation looped', { fill: 'white' }); } else { loopText.text = 'Animation looped x2'; //animation.loop = false; }*/ } </script> </body> </html> See you guys, hope you are great!
  3. Hello! At the beginning of the year, I have a plugin to manage behaviors (based on construct 2) in Phaser games. Now I'm creating some behaviors. Please feel free to help me with testing or feedback. The plugin: https://github.com/luizbills/phaser-behavior-plugin (How to install and use on README) Some behaviors: https://github.com/luizbills/phaser-behaviors (see the Pull Requests too) Check out demo game using "bevahiors": https://github.com/luizbills/phaser-platform-game (see the file game.js)
  4. I'm using Phaser v2.6.2 . In my code, I use looping timers created with : this.game.time.create(); The timers callbacks / functions are working as expected on desktop which runs at 16 ms / 60 FPS. The issues appear on mobile which runs at 18 ~ 20 ms / 50 ~ 54 FPS. The timers seem to skip some function calls while looping. I've found a solution to this problem: this.game.forceSingleUpdate = false; Now the timers behave as expected on mobile devices but the overall feel of the game is slow / lag / jagged . So I need to use both timers and : this.game.forceSingleUpdate = true; I'm not able to find a solution to this even though I've spent a few days looking into the Phaser core ( Game.js and Timer.js ). I think I need to find a way to synchronise timers with the logic update.
  5. Hello folks, after nearly over an hour of debug action, I found something strange. I create an object out of some smaller objects using merge. After that, I keep one "original" in background with "isVisible = false". Then, if the settings change, I throw everything away and copy this "original". Set material, size, etc... Then I create instances of this. But I always had an error within babylon while copy. The first time it works as expected. But the second time I use copy with this "original" object, I have this error: (Line 27524: CANNOT SET .references OF UNDEFINED #ERROR) for (var kind in this._vertexBuffers) { if (numOfMeshes === 1) { this._vertexBuffers[kind].create(); } this._vertexBuffers[kind]._buffer.references = numOfMeshes; <==== CANNOT SET .references OF UNDEFINED #ERROR if (kind === BABYLON.VertexBuffer.PositionKind) { mesh._resetPointsArrayCache(); var extend = BABYLON.Tools.ExtractMinAndMax(this._vertexBuffers[kind].getData(), 0, this._totalVertices); mesh._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum); mesh._createGlobalSubMesh(); //bounding info was just created again, world matrix should be applied again. mesh._updateBoundingInfo(); }}I noticed, that after copy, in Mesh._geometry._meshes a mesh had been added. This happend in the new copy as well as in the original one. That's the reason the second round it has "numOfMeshes = 2" and runs into this error. I have no idea why this happens or why the orignial mesh is affected by copy function? I ended up with this (ugly) workaround: function getBarType2() { var Clone = window.BarType2.clone("Pfosten Typ 2"); window.BarType2._geometry._meshes.pop(); Clone.isVisible = true; return Clone;}With this, it works as expected! Can anyone explain what happens here? Have a nice day Kevin
  6. ironicnet

    Behaviors

    Hi guys, how are you doing? I'm new in phaser and in game development with JS. Anyone has implemented some kind of behaviors logic like flocking? I tried to "Port" this example in processing.js into phaser, but i didn't have any luck. http://processing.org/examples/flocking.html Can someone show me some light and give some guidelines? Thanks!
  7. helo! i cant figure out how my homeless enemy can sense the end of the platform. i want this homeless patrol without fall down. thx for any advice
  8. Hello again After several hours of unsuccessful attempts, I noticed that the babylonjs behavior was not the same that the javascript behavior.For exemple :http://www.babylonjs.com/playground/#1A6PNC#2The value of a.x is now 1 and the value of c is 0.Knowing that babylonjs is a javascript library it seems strange to change the language logic. So, is there an explanation for this choice ? Moreover, but there is no link with my precedent question, where can I find an html version of babylonjs 11 ? It would be useful for jsFiddle.
×
×
  • Create New...