parkm / oldbpm

A JavaScript game where you shoot at bubbles.
0 stars 1 forks source link

Depth #34

Closed parkm closed 10 years ago

parkm commented 10 years ago

Depth problems seem to come and go all the time. This issue will only be closed once we have a permanent solution.

parkm commented 10 years ago

So currently I'm not getting any depth issues. The biggest issue I was noticing was the background doing some weird flashing. I've fixed this issue before by messing around with depth values. For some reason I couldn't fix it this time, so I actually removed all depth and it still did it. I ended up fixing it by using a 'TilingSprite' instead of 'Sprite', not sure why this fixes it.

Anyway I'm thinking of using DisplayObjectContainers as layers instead of depth. So:

this.guiLayer = new DisplayObjectContainer()
this.pinLayer =  "           "
this.bubbleLayer "         "
this.layerHigherThanBubbles 
etc

this.guiLayer.addChild(myText);
this.bubbleLayer.addChild(bubbleBatch)
this.layerHigherThanBubbles.addChild(pinShooter)
dgpt commented 10 years ago

Layers sound like a good idea. Where/how will this be implemented?

On Sun, May 18, 2014 at 4:58 PM, Parker Miller notifications@github.comwrote:

So currently I'm not getting any depth issues. The biggest issue I was noticing was the background doing some weird flashing. I've fixed this issue before by messing around with depth values. For some reason I couldn't fix it this time, so I actually removed all depth and it still did it. I ended up fixing it by using a 'TilingSprite' instead of 'Sprite', not sure why this fixes it.

Anyway I'm thinking of using DisplayObjectContainers as layers instead of depth. So:

this.guiLayer = new DisplayObjectContainer() this.pinLayer = " " this.bubbleLayer " " this.layerHigherThanBubbles etc

this.guiLayer.addChild(myText); this.bubbleLayer.addChild(bubbleBatch) this.layerHigherThanBubbles.addChild(pinShooter)

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/34#issuecomment-43456290 .

parkm commented 10 years ago

Just think of them as SpriteBatches. So you add display objects to them and then add the layer to the state via addDisplay. So let's say you're in an object and you want to add to the gui layer. You would do: this.addDisplay(myGraphic, this.state.guiLayer)

But we may not need them if I can fix depth. Currently everything seems fine with it, so I'm gonna see if I can support objects with the same depth values. I'm thinking that Array.sort is just crappy so I'm gonna implement a sort just to make sure.

dgpt commented 10 years ago

Okay. I think Layers are a good idea, too. At the very least, they could be automated.

On Sun, May 18, 2014 at 9:00 PM, Parker Miller notifications@github.comwrote:

Just think of them as SpriteBatches. So you add display objects to them and then add the layer to the state via addDisplay. So let's say you're in an object and you want to add to the gui layer. You would do: this.addDisplay(myGraphic, this.state.guiLayer)

But we may not need them if I can fix depth. Currently everything seems fine with it, so I'm gonna see if I can support objects with the same depth values. I'm thinking that Array.sort is just crappy so I'm gonna implement a sort just to make sure.

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/34#issuecomment-43462847 .

parkm commented 10 years ago

Depth has been doing well recently. Sometimes weirdness can appear when setting a lot of graphics to depth 0, but grouping objects on different depth levels works fine. So I'm thinking instead of using arbitrary numbers we should put them in a var like:

thing.depth = -10;
//should be
var guiDepth = -10;
thing.depth = guiDepth;

Problem is finding a good place to put guiDepth and other depth values.

dgpt commented 10 years ago

I haven't noticed any depth issues at all lately.

I really like that, actually. We can store them in an object in gfx. Perhaps gfx.layers?

On Fri, May 23, 2014 at 9:50 PM, Parker Miller notifications@github.comwrote:

Depth has been doing well recently. Sometimes weirdness can appear when setting a lot of graphics to depth 0, but grouping objects on different depth levels works fine. So I'm thinking instead of using arbitrary numbers we should put them in a var like:

thing.depth = -10; //should be var guiDepth = -10; thing.depth = guiDepth;

Problem is finding a good place to put guiDepth and other depth values.

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/34#issuecomment-44076834 .

parkm commented 10 years ago

So gfx.layers.gui?

dgpt commented 10 years ago

Yeah, sounds good to me.

On Fri, May 23, 2014 at 10:52 PM, Parker Miller notifications@github.comwrote:

So gfx.layers.gui?

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/34#issuecomment-44077791 .

dgpt commented 10 years ago

Fire element graphic flashes on collision with pin, possibly death.

parkm commented 10 years ago

Reopen if any issues occur.