Hi,
I am struggling again with sprites and layers. I am trying some tips from previous
examples on this forum. I have a foreground layer which is the half top screen
like this:
BackgroundLayer = Core.class(Sprite)
local backgroundLayer = BackgroundLayer()
A layer where some bitmaps will be added every second and falling down:
FiguresLayer = Core.class(Sprite)
local figuresLayer = FiguresLayer.new()
And a foreground layer from half of the screen to the bottom:
ForegroundLayer = Core.class(Sprite)
local foregroundLayer = ForegroundLayer.new()
I want that the figures will be disappear when falling down and reaching the
foreground layer. So I tried to first add the backgroundLayer to the stage,
then the figuresLayer and at last the foregroundLayer. Result is that due the
timed addition of the new bitmap/sprites they will be on top of all the layers.
They will not disappear at all below the foregroundLayer.
Is there a good way to handle timed sprite additions?
Regards,
Marc
Comments
I seem to remember reading that you don't actually have to remove it first, simply adding it again will bring it to the front, but without trying that I can't be sure :-S
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Thanks for your comment. To make it more clear I've drawn a sketch.
I tried to create 3 layers with different graphics. When all the graphics
are added I add the layer to the stage.
I thought that the falling figures layer must be between the foreground
and the background layer. The difficulty is that the falling objects will
keep coming every second. I don't know how to add the objects to the
layer and finally to the stage in a proper way.
Note that I've made the pipe sprite with the contact (onContact event)
part of the foreground layer. Objects who are directed to the pipe have
to disappear and give points for example. Now I see the figures on top
of the pipe. Redrawing the foreground layer could be an interesting
option. I hope that I've made it more clear.
Regards,
Marc
right. I created separate parts. I am always struggling with stacking sprites.
You helped me before on this but I have no a little devious situation.
Regards,
Marc
Regards,
Marc
Regards,
Marc