Search the Community

Showing results for tags 'change'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 12 results

  1. Hi everyone, I need help. Could someone write for me function 'myFunction' which changes the colour of the material. I don't know in which place I need add this. Commented function setTimeot change the colour. When I added function 'myFunction' in this place i have error 'myFunction is not defined'. Do you have good tutorials for the beginners? <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> <title>Babylon - Getting Started</title> <!-- link to the last version of babylon --> <script src="js/babylon.2.5.js"></script> <link rel="stylesheet" href="css/style.css"> </head> <body> <canvas id="renderCanvas"></canvas> <div> <button onclick="myFunction()">Click me</button> </div> <script> window.addEventListener('DOMContentLoaded', function() { // your code here var canvas = document.getElementById('renderCanvas'); var engine = new BABYLON.Engine(canvas, true); var createScene = function() { // create a basic BJS Scene object var scene = new BABYLON.Scene(engine); // create a FreeCamera, and set its position to (x:0, y:5, z:-10) var camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 5,-10), scene); // target the camera to scene origin camera.setTarget(BABYLON.Vector3.Zero()); // attach the camera to the canvas camera.attachControl(canvas, false); // create a basic light, aiming 0,1,0 - meaning, to the sky var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), scene); // create a built-in "sphere" shape; its constructor takes 4 params: name, subdivisions, radius, scene var sphere = BABYLON.Mesh.CreateSphere('sphere1', 16, 2, scene); // move the sphere upward 1/2 of its height sphere.position.y = 1; // create a built-in "ground" shape; its constructor takes 5 params: name, width, height, subdivisions and scene var ground = BABYLON.Mesh.CreateGround('ground1', 6, 6, 2, scene); // Define a material var material = new BABYLON.StandardMaterial("std", scene); material.diffuseColor = new BABYLON.Color3(0.5, 1, 0.5); //setTimeout(function(){ material.diffuseColor = new BABYLON.Color3(0.5, 1, 2); }, 3000); // Apply the material sphere.material = material; // return the created scene return scene; } var scene = createScene(); engine.runRenderLoop(function() { scene.render(); }); window.addEventListener('resize', function() { engine.resize(); }); }); </script> </body> </html>
  2. I'm a little irritated at the moment. A sprite sheet is to be loaded and displayed. The sprite sheet consists of several individual images (2, 3, ... 5, ... 10, ... any). I would like to change these pictures. Unfortunately, I find no suitable example. On the basis of an animation, with Play and Change Texture, it can not be, it is always only a single picture to the next switch. Does anyone have a suggestion? Thank you. PS: Of course, I also have a JASON file to it.
  3. Hi all, currently I got problem that I have a websocket thread to communicate with the server. and the game object is also start in the process, the situation is like this. when I got the response: A from the server, I will change the game to a new state by game.state.start('NEW STATE'); and then I will get the response: B, C from server, then I need to run some functions defined in the new state, like this game.state.callbackContext.function_in_new_state(); but it is not working, then I loged the state game.state.current I found that the current state is still the OLD ONE. I know the state change need some time, BUT is PHASER provide any callback method when the current state changed to another one, thx everyone.
  4. i have change fbx file to babylon, and it have walk, run animaion. in default, it start walk animation. like sketchfab. how get the animation key and change the animation?
  5. mm

    Change tilemap size

    Is it possible to change the tilemap size during gameplay in phaser? Thanks.
  6. ok. I have same problem in there: I am digging all documentation and examples for solving that problem. But i have nothing really. I can post my own codes if anyone want. And that example: Its including same problem. If you run it carefully, you can see first place objects colliding world bounds, but after changing state its not colliding.
  7. Hello. I've noticed that many people have a similar problem. If sprite has physics enabled: how to change its position without interfering with physics system? It's a famous 'fly off the screen' problem. If position is changed, physics system is using new coordinates to continue its work, hence sprite's surprising behavior. Let's say,that sprite is moving and when it's clicked it should move 100px on the right and then continue its movement), maybe with a different speed. How to achieve that? My solution is: sprite.body.moves = false;object.sprite.x += 100;... and then in game's update() function: function update() { sprite.body.reset(sprite.x, sprite.y); sprite.body.velocity.x = 10; // new velocity sprite.body.moves = true;}I understand, that physics system must be after one update, otherwise switching between body.moves = falseand body.moves = truewill not have a chance to work. After that sprite is translated 100px in the right, plus it has new velocity. The question is: is there a proper Phaser way to achieve that without splitting this operation on instructions executed before and after update() function? It's seems like a common need and yet it takes that little extra effort to achieve desired effect
  8. does someone know how to change the text color and font? game.debug.text(' text ' , 32, 42);
  9. Hi everyone!! I´ve developed a game based on "Spring Ninja" and I made it responsive: As you can see the game auto-adapts to all screens taking all the available space on the window. It does the same in all platforms. I use the innerWidth and innerHeight to load a different size depending on the screen ratio: var innerWidth = window.innerWidth;var innerHeight = window.innerHeight;var gameRatio = innerWidth/innerHeight;if(innerWidth > innerHeight){ game = new Phaser.Game(Math.ceil(320*gameRatio), 320, Phaser.AUTO); } But I have a problem for mobile: when I load the game on "Portrait" and then the user changes the orientation I would like to reorder the Canvas to autoadapt to the new screen ratio. But I´m can´t do it. I wrote this code: $(window).resize(function() { resizeGame(); } );function resizeGame() { var innerWidth = window.innerWidth;var innerHeight = window.innerHeight;var gameRatio = innerWidth/innerHeight; game.width = Math.ceil(320*gameRatio); game.height = 320; game.stage.bounds.width = Math.ceil(320*gameRatio); game.stage.bounds.height = 320;game.scale.refresh(); } This code is supposed to set the new dimensions to the game, but instead of reescaling everything properly every object gets deformed: Is it possible to render again the game with the new size?
  10. Hi Gentlemen! The question is in the title... Can I change the execution speed of an animation with/in Babylon? Let me explain : I have a skeleton imported from Blender in Babylon. This skeleton has many animations. In my game projet, I have many characters based on the same skeleton. So, characters all have the same animations. Now my problem : I would like to make animations be differents in playing although they have the same skeleton. Why? Because I have many animations which are the same except the speed execution between the different characters. Otherwise, I will have to make an animation by characters and I prefer factorize as possible my code... (Especially if the animation is the same!) Thank you for your opinion on this issue. Zino
  11. Hi I'm working on a prototype and have some problems with P2. I've some bubbles in the scene which grow over time. When changing the body's radius in the update function the whole scene gets out of control and the bubbles go crazy, jumping around everywhere. create: function() {; for (var i = 0; i < 10; i++) { var x = (Math.random() * | 0, y = (Math.random() * | 0, d = 30; var s =, y, ''); s.anchor.set(0.5, 0.5);; var p2Shape = s.body.addCircle(d, 0, 0, 0); s.body.debug = true; this.objects.push({ sprite: s, physicShape: p2Shape }); } }, update: function() { for (var i = 0; i < this.objects.length; i++) { var o = this.objects[i]; // same result //o.sprite.body.setCircle(o.physicShape.radius + 0.1, 0, 0, 0); o.physicShape.radius += 0.1; o.physicShape.boundingRadius = o.physicShape.radius; } }Am I doing something terribly wrong here?
  12. Hi! I have a sprite scaled to a smaller size (0.5, 0.5). I want that when the player press the "down" the size change. What occurs to me is that changes the size but scaled back to (1, 1) Greetings!