Search the Community
Showing results for tags 'static'.
-
Hey guys, So I am currently working on a project where I have dynamic bodies constrained to static bodies through the use of createRevoluteConstraint so that the dynamic bodies only rotate where the static body is located. That part is working, now the next thing I want to be able to do is click and drag on the static bodies and move them to any point in game world and continue to have the dynamic bodies constrained to them. I have this partially working by calling sprite.body.static = false when the mouse is clicked down and then sprite.body.static = true when the mouse is released. I also have the update function constantly calling sprite.body.static=true when the body is supposed to be static. The issue I am running into is that when I release the mouse button the static body seems to drift in space based off how fast my mouse is moving when I release it. Gravity doesn't seem to have any effect on it though which is good. So, does anyone have some ideas on how to go about fixing this? I want it to be completely static as soon as I release the mouse. Thanks
-
Cocoonjs + Pixi js; Canvas looks "Glitchy"; Canvas+ & Webview
Shadowstep33 posted a topic in Pixi.js
Hi all, I'm trying to get a project working in Cocoonjs with Pixi. At first I was under the impression that I could just take my code and place it in a Canvas+ and be good to go. I'm now realizing, to utilize my UI I will need access to the full DOM features, so I also need to use a Webview. Now I am trying to use both and am refactoring my code (side question: Does Ludei claim you can use the same code because it works if you only use a Webview? Do they expect that you can use the same code if you need to use both a Canvas+ and Webview? I don't see how they could since you have to write custom code to make Webview and Canvas+ interact). So here's the problem; I finally got all errors and warnings out of the code after doing a bit of refactoring. I've separated all to most of the PIXI/rendering specific code from the jQuery and DOM related code. I load the Webview, the app connects to my game server as expected but the canvas looks glitchy. By that, I mean it looks like what would accompany static on a TV, but less exaggerated. It will be mostly black with glitchy, patterned grey pixels interspersed. Every once in a while it will jump to having more grey static and then go back to more black. I can provide code or screenshots if needed. I am using Pixi v3 (I think v3.0.6). I am also using pixi-spine (unsure of the version). Autodetect renderer seems to be using Canvas renderer. Has anyone experienced (and fixed) this kind of thing? -
I'm developing a game which makes use of the P2 physics system. I have a group of sprites with static P2 bodies which must collide with another sprite with a dynamic body. This all works dandy until I call the .kill() method on one of the static bodies and then respawn it somewhere else via .reset(x,y). After reseting it, it no longer collides with the dynamic body? After hours of debugging I've figured out that if I make the bodies static then collisions still work after a kill/reset. This doesn't help me that much however as I need them to be static. I've made a jsfiddle to illustrate the problem: http://jsfiddle.net/xdb9s6d1/5/ (NOTE: click the big boxes to kill/reset them) Cheers!
-
Hello pixi developers, I am learning about html5 games development. I choose pixi, because it is lightweight and fast. My first app is simple. One sprite with three callbacks - "click", "mouseover" and "mouseout". //create an new instance of a pixi stage.var interactive = true;var stage = new PIXI.Stage(0x66FF99, interactive);// create a renderer instance.var renderer = PIXI.autoDetectRenderer(800, 500);// add the renderer view element to the DOMdocument.body.appendChild(renderer.view);// create interactive spritevar spriteT = PIXI.Texture.fromImage("iapple2.png");var sprite = new PIXI.Sprite(spriteT);sprite.setInteractive(true);stage.addChild(sprite);// callbackssprite.click = function(d) { console.log("clicked");};sprite.mouseover = function(d) { this.scale.x = 1.1; this.scale.y = 1.1; };sprite.mouseout = function(d) { this.scale.x = 1; this.scale.y = 1;};requestAnimFrame(animate);function animate() { requestAnimFrame(animate); // render the stage renderer.render(stage);};As you can see, screen is static unless you click or move mouse over sprite, but main animation loop constantly consumes CPU resources. Is there a way to avoid this? For example, render only when mouse callbacks occurs.