Search the Community
Showing results for tags 'update'.
-
multiplayer [PHASER] BlockTanks - A Simple Multiplayer Tank Game
kevdude posted a topic in Game Showcase
Check out BlockTanks, a simple yet addicting MMO Tank Game made with nodeJS and Websockets. In BlockTanks, you move a tank and shoot players on the opposite team, getting as many kills as you can. No need to create an account, just type in a name and play! The game's features include: Real time player combat A maze-like map that two teams of tanks can navigate through Four types of power-ups Chat features Tank Skins I made a post about this game a few weeks back, and I have been working on the game since. Here are the new features: By popular request, I've made an invincibility power-up that lasts for ten seconds. The map changes every day to keep the game interesting. I have added more tank skins, along with a list of all the current working tank skins. Server bugs have been fixed to reduce server crashes. A respawn timer has been added and the kill count at the top has been redesigned. Play the game at: blocktanks-kevdude749.rhcloud.com Hope you like it! Also, if anyone has any tips/experience with promoting and marketing a game, I would be glad to know UPDATE: BlockTanks now has a bot feature which allows for single player gaming when no one else is online (which occurs often ). If you log on and there is no one else online, a bot will spawn on the other team and fight against you until someone else joins. Please give it a try and let me know what you think of the new AI! -
https://www.zen-games.com/ (former mini.ninja) * Add Card.Ninja (MTG card tester) * Update Ubik 2D (fullscreen viewport) * Update Stones in Clouds Game (spells) * Update the blog * Update android application
-
Hello guys , As i unity developer i just want to ask a quick question Which method in mesh class Match update function in unity .. What it means i want each mesh to have it's own update method rather use scene.registerBeforeRender() Which controls every update/render happens in the scene I've used those func's mesh.onBeforeDrawObservable() mesh.onAfterRenderObservable() But Explicitly i don't know if it's best choice or not and i have little problem with it .. Also those methods can't be executed behind camera view (the mesh must be in the view of camera to allow those type of functions to be executed) so guys what do u think ? Thanks in advance
- 2 replies
-
- afterrender
- beforerender
-
(and 3 more)
Tagged with:
-
Hi, Hope someone can help if I try to do a key press my animation stops until I let go of the key. (keys a and d) to move left and right - is there a way for the key press .onDown to be used once or an aletrantive way to have my animation play when the key is held down, I've tried using the docs but can't seem to find a solution eg demo below http://html5gamer.mobi/2019/ code snippet when pressing d if (this.keyRight.isDown){ this.player.anims.play('walkProper'); this.player.flipX = false; this.player.setVelocityX(150); } Thanks in advance Eric
-
I have a very simple Pixijs project that display a image. There is no animation or anything in it. I wrote simple code to adjust the app size when the user resize the browser window. function resize() { var dis = Math.min(window.innerHeight, window.innerWidth); app.view.width = dis; app.view.height = dis; } window.onresize = function(event) { resize(); }; The problem I have is the canvas get resized, but the content inside it does not redraw. Is there a function in pixi that I can call to redraw or update the canvas?
-
solved How to dynamically update the geometry of a mesh?
leota posted a topic in Questions & Answers
I've created a BoxGeometry and assigned it to a Mesh, then when I click on the Mesh I would like to trigger an update of the geometry, for example change its "size" parameter. Is there a method I need to call on the Mesh to update it? I can see that the size property of the geometry gets updated, but the Mesh is still using the cached version. This is probably an easy thing to do, but I'm struggling a bit as I'm very new to Babylon. I've created a PG here: http://www.babylonjs-playground.com/#JTA9RH Any help would be much appreciated -
How to pass the cursor object to a method that belongs to a class that inherits the Phaser.Sprite class? I have a class that inherits from Phaser.State in which I create a cursor object and pass it to the update method from another class. class Play extends Phaser.State { create() { this.physics.startSystem(Phaser.Physics.ARCADE) ... this.player = new Player({ game: this.game, x: 32, y: this.world.height - 150, asset: 'dude' }) this.game.add.existing(this.player) } update() { const cursors = this.input.keyboard.createCursorKeys() this.player.update(cursors) } } Player class - problem occurs in the if condition: class Player extends Phaser.Sprite { constructor({ game, x, y, asset }) { super(game, x, y, asset) this.game.physics.arcade.enable(this) this.body.bounce.y = 0.2 this.body.gravity.y = 300 this.body.collideWorldBounds = true this.animations.add('left', [0, 1, 2, 3], 10, true) this.animations.add('right', [5, 6, 7, 8], 10, true) } update(cursors) { this.body.velocity.x = 0 if (cursors.left.isDown) { this.body.velocity.x = -150 this.animations.play('left') } } } Error message: "TypeError t is undefined"
-
I am trying to write a plugin for RPG Maker MV, which uses Pixi.js. The problem may be an incompatibility, but I have asked several people now and I just don't know where else to ask. The PIXI Version I tried it on was 4.5.4 Kreaturen.Kampfsystem.StarteKampf = function () { // Kampf Übergang for (var i = 1; i <= Kreaturen.Kampfsystem.KampfÜbergang.AnzahlFrames; i++) { Kampf_Anfang.frames.push(PIXI.Texture.fromImage(Kreaturen.Kampfsystem.KampfÜbergang.Pfad + i + '.png')); } Kampf_Anfang.anim = new PIXI.extras.AnimatedSprite(Kampf_Anfang.frames); console.log(' Kampf_Anfang.anim: ', Kampf_Anfang.anim); Kampf_Anfang.anim.animationSpeed = 0.5; Kampf_Anfang.anim.loop = false; Kampf_Anfang.anim.gotoAndPlay(0); // force reset frame Kampf_Container.addChild(Kampf_Anfang.anim); SceneManager._scene.addChild(Kampf_Container); Kampf_Anfang.anim.onComplete = function() { console.log(88888) Kreaturen.Kampfsystem.KampfAktiv = true; } } Everything works fine, the picture gets displayed but the animation just doesn't play... And because of that the .onComplete function never triggers Does anybody have an idea why this may occur?
- 8 replies
-
- rpg maker mv
- animatedsprite
-
(and 1 more)
Tagged with:
-
Hello everyone, I'd like to make drag n drop on meshes keeping the link between meshes, like in this example (https://www.babylonjs-playground.com/#17EGSU#8). I don't know how to set the position of curve ? -> Maybe, with https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh, and the example https://www.babylonjs-playground.com/#1UZIZC#6, but I don't understand why position table is so big, and to set from mesh position ? Thank you
-
Hi erveryone ! I'm trying to make some notes appearing when the music hits a certain time in Phaser, but when I log the "hit times" in the console, it only show up sometimes. I have an object of "notes", the key being the time I expect the note to show : { 1371: { jam: 1, duration: 0.40 } } But, in the update loop, if I do something like this : update () { if (music && music.currentTime) { if (notes[music.currentTime]) { console.log('notes[music.currentTime].jam', notes[music.currentTime].jam) } } } It logs only some of the notes, randomly. Even something like this : if (music && music.currentTime) { var time = Math.floor(music.currentTime) if (time === 1371) { console.log('time', time) } } never trigger the log Do you have any idea why ?
-
Hello, I have a PIXI app with many child (in a tree structure). I need to update only child that contains the method "update". There is any logic inside PIXI for this or I would need to add each of those object in the shared.ticker? I did this, but there could be a better way that could allow me to remove the ticker listener if I need to. THIS IS NOT FOR SPRITE ANIMATIONS, it's mostly to change objects position https://jsfiddle.net/32ce1rcw/2/ Thanks.
-
I have a textblock on my gui that counts how many shots I have taken in my game. I increment the shot counter successfully but I don't know how to change the number currently displayed on the screen. Here is what I am trying (unsuccessfully). scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnEveryFrameTrigger}, function () { text13.text = shots.toString(); advancedTexture.update(); }));
-
In my platformer, the player has a number of different weapons (gun, energy blast, homing missile) and there may be a number of enemies (up to maybe 6) who will have one of the same weapons. From my understanding of the weapon plugin and tutorials, I should then be making a different weapon object for each of the players weapons and for each enemy. As I am wanting to attach a particle emitter to missiles I'm then going to extend the bullet class to make a missile. Question 1: I want autofire from enemies to fireAtSprite rather than just fire, I'm assuming the best way to do this is to extend the weapon class and overwrite the fire() method to call fireAtSprite() instead? Or is there a better way? Question 2: Where do I put the collision checks for the bullets? I can see a couple of options but would really like to know the performance implications as to which would be better. 1) Put an arcade collision call in the extended bullet update method to handle hitting scenery and hitting enemies - this seems neat in some ways as the code for the bullet hitting something sits with the bullet itself, however it feels like I'm going to end up with a lot of separate collision calls. 2) Put an arcade collision call in the state update along the lines of: this.enemies.forEach(function(enemy){ this.game.physics.arcade.collide(enemy.weapon.bullets, this.collisionLayer, this.shotCollisionLayer, null, this); this.game.physics.arcade.collide(enemy.weapon.bullets, this.player, this.shotPlayer, null, this); }, this); 3) In the custom bullet constructor, add all enemy bullets to an enemyBulletsArray and collide this in the state update method this.game.physics.arcade.collide(this.enemyBulletsArray, this.collisionLayer, this.shotCollisionLayer, null, this); this.game.physics.arcade.collide(this.enemyBulletsArray, this.player, this.shotPlayer, null, this); Many thanks, Gordon
-
The stable version of this PG runs OK https://playground.babylonjs.com/indexstable#4G18GY The latest version of same PG https://playground.babylonjs.com/index.html#4G18GY produces this error Line 14:28512 - Unable to get property 'update' of undefined or null reference
-
Hello guys, I have some big problems with the performance by switching tabs and the rendering progress. Maybe some of you can help me. (Sry for my english I give my best.) The game about I'm talking is to find under: https://dsbmg.de/slotdemo/app.html It's a slotmachine I build. The big problem is, that some users would like to play the game in more than one tab and some tabs are in background sometimes. Thats why I done the following. The backend is a php file which is doing the whole math and connecting to the database to save player-data for each bet and other things. Then there is a webworker as middleware which communicates with the backend and the frontend builded with phaser. If a user switch the tab, a javascript code recognize the visibiltychange event and then send the new state to the middleware. The middleware itself take this event and switch internal from visible to none-visible and sending a break to the frontend that kills the tweens if there are some. After that point the middleware just "taking" to the backend with a delay, like the slot would be rendering, but without doing anything. (in autoplay mode) After switching the tab back to the front from the background, the visibiltychange event sending a message from the frontend to the middleware which switches the intern state to visible and the next game starting rendering again. But at that point the tweens and updates are not running well. They make a lot of problems which I can't figure out. Do anyone of you have an idea what I can do better? Have you any idea what I can do to get a better performance? If the slot is just running in one tab (background or front) there seems to be no such problems, just if you open another tab with the game. Hope you can help me to build a better engine for the slot.
-
Looks like animations stop updating when they go outside the frustum... this is quite annoying when trying to render stuff which is close to camera, like avatar's body in first person view. When your hands go outside the view, they never come back I tried attaching invisible meshes in animations but it has it's drawbacks and it feels like i'm fighting (a losing battle) against the system. Any suggestions how to force the animations to keep running even when they go outside the view?
-
We can render a scene in Babylon.JS reading values like position/scale from form fields. But does it allow to make changes in scene listening real time changes in input fields like $('input').val() var cusotm_position = $('input').val(); canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, true); scene = createScene(); //draws a mesh at custom_position engine.runRenderLoop(function () { scene.render(); }); $("input").change(function(){ cusotm_position = $('input').val(); delete scene;scene = createScene(); //hangs website for few seconds,need its alternate }); I tried to call scene.render(); on event listener of change in input but that doesn't seem to be doing anything. Is there anything like refrest/update to change to updated variable values. Better if this can be done without removing everything and recreating fresh scene. As delete scene;scene = createScene(); does refresh everything with new variable values but it hangs the website for few seconds.
-
Hi, I have been working on my first full game and decided to try a snake clone. I haven't followed any kind of tutorial and have just been trying to get to grips with the framework. I am however having a few issues and have been stuck for a couple of hours to try and fix a couple of annoying bugs. The first main issue I have with my game is that collisions don't seem to be firing correctly. I have tried to set one up when the head of the snake collides with any of the tail elements which just restarts the game state for testing purposes. This seems to however try to trigger another function which should only happen when a player collides with food. I am guessing I need to setup my collision handlers differently in order to fix this. The other bug is that when a bit of food has been eaten a new sprite it created but just before it does it gets added randomly to somewhere on the screen then disappears but I can't work out why that would be. I setup a git repo of my project so far on github and it can be found here: https://github.com/jaymeh/phaser-snake If someone could offer some advice as to what I can do to fix this I would be very grateful. Thanks
-
Hey all! I'm trying to update my game every time the screen is resized or turned from portrait to landscape and visa versa. What I'm doing right now is using window.onresize = this.resize(); but resize() is being called every frame. Does anyone either know why this isn't working or how to do this better? Thank you!!!
-
Hi guys, I'm creating an UI for my babylon game via the Canvas2D, precisely the ScreenSpaceCanvas2D. Now I want to know if it's possible to update the text dynamically without recreating/overwriting the text2d child every time the score variable (which is used for displaying) is updated. Playground link for simplified case: http://www.babylonjs-playground.com/#2AVSFH#271 Thanks in advance!
-
Hi, how can I add a function to the update function when two objects overlapped? I asked similar question yesterday but this time I asked same question in more clear way. For example, I will take a coin and after this my speedPlayer() function will be activated over and over again, infinitely. How can I do this, thanks.
-
As far as I understand, updating the positions data on a mesh using updateMeshPositions - or other update* functions - only works when the mesh is set to be updateable. This setting can only be done at creation time. All basic shape creation* functions have the updateable option that can be set, but the standard mesh constructor has not. How do I make a custom shaped mesh updatable? I have thought of a workaround, by creating an updateable cube or something and replacing the vertices data with my custom mesh data. I have not tested this, but I will. And another question: it was my take that the updateMeshPositions is the fastest way to update the vertices positions. setVerticesData works also on non Updateables but seems to be slow. Is updateMeshPositions the fastest way to modify the vertices positions? And if not, what is? I am working on a sculpting app, my custom mesh has over 50K positions. Updating vertices is what the app is all about and I need it to be done as smooth and realtime as possible.
-
I have a mesh imported from .babylon file, and it has its animations. I put MeshImpostor in, expecting it to update with the animation, but it's not. It seems like it uses the first frame as the reference to the collision detection. Is there any way to update it? Code is something like this: var mesh = scene.meshes[0]; mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor); //I tried to force it update it too, but doesn't seem to work. function update() { mesh.physicsImpostor.forceUpdate(); }
-
First post! I want to animate an object's position based on input from the user's mouse wheel. The mouse wheel can fire events many times per second. I don't want to destroy the old animation, and create a new one, for each of these many events. I'd prefer to "update" the keyframes of the existing animation instead (i.e. continue the animation from its current frame and position, to a new endPosition at a new keyframe). I'd also like to "restart" the animation again from its current value, if it happens to reach the final keyframe and stop, then the user scrolls again later. What is the preferred way to "update" an animation in Babylon.js? Can I just use animation.setKeys() again to update the keyframes? Also, if the animation completes, then more scroll events are fired later: how can I "restart" the animation from its previous end position, and trigger it to run again to a new end position? Thank you so much in advance for your help!
- 2 replies
-
- animatable
- animation
-
(and 3 more)
Tagged with:
-
Hi everyone! Phaser version: 2.4.3. My intention was to render the cellular automata generated map on the screen. To do this I created a BitmapData object and used a basic set of setPixel(...) loops. Everything works but it took 8 seconds when the 'immediate' flag is true. And when the 'immediate' flag is false the map image just won't be visible at all while the console.log(...) says everything is finished so there's no freezing. Thus, the problem is in bmd.update(...) in the end that has no effect at all. Tried filling the entire bitmap with the white color before the loops: the entire bitmap is white but there's no trace of setPixel calls. create: function this.bmd = this.game.make.bitmapData(automata.width, automata.height);for (var i = 0; i < automata.width; i++) { for (var j = 0; j < automata.height; j++) { if (automata.cellmap[i][j]) this.bmd.setPixel(i, j, 255, 255, 255, false); }}this.bmd.update(0, 0, automata.width, automata.height);var img = this.bmd.addToWorld();img.smoothed = false;img.scale.set(2);
- 1 reply
-
- bitmapdata
- update
-
(and 2 more)
Tagged with: