Trying to create a drawing tool on my app

Hi, got another question I hope you could help me with, I’m creating an app that teaches the user how to draw, Once they go through the steps of learning how to draw each Object they then get to try and draw it I have incorporated a canvas which also Includes a back button so they can look at the steps again but when they return to the Canvas it’s blank again I want to be able to keep the state of the canvas for the user to use

I would have preferred to incorporate like an image popup where there’s five small buttons at the top of the canvas page (for each image in the steps of drawing tutorial) where the user clicks on it and the corresponding step image pops up (canvas is still in background/ not directed to another page) on the screen and has a close button on it so user can resume their drawing. But am still relatively new to all this and cant seem to work it out.

Thanks in advance

also i ended up using template from T and G apps (director template). and modified it for my app. [import]uid: 166525 topic_id: 34395 reply_id: 138241[/import]

Hi Lemi,

FIrst of all thanks a lot for purchasing and we’re glad you like it :slight_smile:

In regards to your question, if you have the five step buttons along the top with an associated ID for each, you could do something like the following to display an image related to that button over everything else.

--Shows your one of your drawing steps images.  
local function showStep( event )  
 if event.phase == "ended" then  
 --Get the id of the button. You have to set this when you create the button  
 local id = event.target.id  
 local image, close  
  
 --Function for closing this step popup.  
 local function closeStep(event)  
 display.remove(image); image=nil  
 display.remove(close); close=nil  
 return true  
 end  
  
 --Open an image that is related to the button you pressed  
 image = display.newImageRect("stepbystep"..id..".png", 480, 320)  
 image.x = \_W\*0.5; image.y = \_H\*0.5;  
 overlayGroup:insert(image) --Insert it ontop of everything else.  
   
 --Then show a close button ontop of that.  
 close = display.newImageRect("closeBtn.png", 40, 40)  
 close.x = \_W-30; close.y = 30;  
 close:addEventListener("tap", closeStep)  
 overlayGroup:insert(close)  
 end  
 return true  
end  
button:addEventListener("touch", showstep)  

Obviously i have just made up the images and groups, but you get the general gist :slight_smile: You could also do it a different way by creating a whole new group inside that function and just transitioning that up onto the screen as a popup. Either way is good! [import]uid: 69826 topic_id: 34395 reply_id: 138257[/import]

Thank you, yay finally got it sorted. hey would it be possible for T & G apps to produce a whack a mole style app where it has levels. each level the moles pop out faster i have tried modifying tutts+ version but a lot missing that i couldn’t figure out. I would definitely buy it.

Thanks again [import]uid: 166525 topic_id: 34395 reply_id: 138264[/import]

theres one thing im confused by

what does the following mean and how do i fill in this bit or leave it
[lua] local id = event.target.id

–Open an image that is related to the button you pressed
image = display.newImageRect(“stepbystep”…id…".png", 200, 200)
image.x = _W*0.5; image.y = _H*0.5;
overlayGroup:insert(image) --Insert it ontop of everything else.
[import]uid: 166525 topic_id: 34395 reply_id: 138269[/import]

never mind
thank you so much again [import]uid: 166525 topic_id: 34395 reply_id: 138270[/import]

Sorry i didn’t see your questions in time! Glad you got it sorted though, figuring stuff out by yourself is the best way to learn :slight_smile:

I’ve added “Whack a Mole” to our list of templates to create, the list is getting pretty large so i don’t know when it will be made, but we will do it eventually! Thanks for the tip. [import]uid: 69826 topic_id: 34395 reply_id: 138277[/import]

I’m really glad to be wrong in this case! Will definitely give that drawing template a look once my project gets far enough along! [import]uid: 41884 topic_id: 34395 reply_id: 138285[/import]

Thank you again so much [import]uid: 166525 topic_id: 34395 reply_id: 138295[/import]

No problem :slight_smile:

And to clarify Richard, there isn’t any per-pixel painting support in the template, its literally just “cheating” with circles/lines. I’m not sure about Deep Blues Apps template, but theirs is more advanced and probably won’t cheat as much as ours :stuck_out_tongue: [import]uid: 69826 topic_id: 34395 reply_id: 138296[/import]