I have started on making a small drawing program.
I have a background png and a drawing tool png.
As you drag the tool around the window it draws very small rectangles (looks like pixels).
My problem is that as i draw the rectangles, they show thru the draw tool.
I’ve tried making the drawing tool png opaque
object. alpha = 1
but it doesn’t work.
Any help would be appreciated. [import]uid: 34179 topic_id: 6834 reply_id: 306834[/import]
jmp909
February 19, 2011, 7:38am
2
i’d put your drawing in a separate displayGroup below the drawtool (ie put the tool in its own displayGroup above that)
otherwise if theyre all just in one displayGroup (say “canvas”) you could just call
[lua]canvas:insert(tool)[/lua] after every draw to bring it to the front
there’s also :objectToFront() now i believe…check the docs
[import]uid: 6645 topic_id: 6834 reply_id: 23863[/import]
Thanks for the response!
I should get more familiar with the API’s.
I need some help understanding display groups apparently.
I’ve only been at this two weeks, so thanks for the patience.
[import]uid: 34179 topic_id: 6834 reply_id: 23940[/import]
jmp909
February 19, 2011, 8:11pm
4
do you use Flash? theyre the same as DisplayObject Containers.
check the following code:
[lua]-- create a new display group
local canvas = display.newGroup()
– create a new display group… essentially “layer”.
– this is now above canvas
local HUD = display.newGroup()
– create some blobs
local blob = display.newImage(“blob.png”)
local blob2 = display.newImage(“blog.png”)
– put the blobs in the canvas
canvas:insert(blob)
canvas:insert(blob2)
– scale the canvas
canvas.xScale=0.5
canvas.yScale=0.5
– add stuff to the hud
local radar = display.newImage(“radar.png”)
HUD:insert(radar)[/lua]
so now your radar will always appear above your blobs as it’s in your separate HUD layer (displayGroup) above them
[import]uid: 6645 topic_id: 6834 reply_id: 23971[/import]
Great example.
I now get it!
Thank you! [import]uid: 34179 topic_id: 6834 reply_id: 24100[/import]