I need to draw a circle over my image sprite, but using the DrawCircle Function, the circle always goes behind the Image Sprite? Can anyone please help me fix this up?

365 views
Skip to first unread message
Assigned to shadow...@gmail.com by me

sw...@teampumpkin.com

unread,
Mar 2, 2014, 1:30:02 AM3/2/14
to mitappinv...@googlegroups.com
Please SEARCH in this forum before posting your question.   There's a good chance your question has already been asked.

If you are asking for technical help, you must provide the following information:
- Are you using MIT App Inventor Classic, MIT App Inventor 2, or something else (what?)
- What OS are you using? (e.g, MacOS 1.8, Windows 8, ...)
- What browser are you using (e.g, Chrome version 30, Firefox 24, IE 8, ...)
Also provide as much information as you can, such as screenshots and instructions that will let others duplicate the issue.

Enis

unread,
Mar 2, 2014, 1:59:51 AM3/2/14
to mitappinv...@googlegroups.com, sw...@teampumpkin.com
As far as I know, when you draw the circle, you're drawing it on the canvas, which is always behind the sprite.

What are you trying to do with the circle after it's drawn?

Swati Nathani

unread,
Mar 2, 2014, 2:11:37 AM3/2/14
to Enis, mitappinv...@googlegroups.com
I have a canvas background. I upload the Image Sprite (from cam / device). Then I place translucent circles on it and then save the canvas.

Problem is that my circles are going behind the Image Sprite which is defeating the purpose.

Enis

unread,
Mar 2, 2014, 2:21:50 AM3/2/14
to mitappinv...@googlegroups.com, Enis, sw...@teampumpkin.com
So, do you want to draw the circle ON the sprite?  If so, there's probably a way to do it and its tricky.  You'd have to use another invisible canvas, size the canvas to the sprite, put the sprite IMAGE ONTO the canvas, then draw the circle on top of the sprite image, then save the canvas as a new image, which would become your new sprite.  I've never done this, so I can't tell you how to do it, but take those steps and play around a bit.

If you draw on the canvas directly as you're doing now, it'll always be behind the sprite.

Abraham Getzler

unread,
Mar 2, 2014, 12:52:28 PM3/2/14
to mitappinv...@googlegroups.com, sw...@teampumpkin.com
If you employ a Ball instead of drawing a circle on the canvas,
you can control which layer is on top using the z values of your sprite and ball.

If you don't want a solid ball, use a second smaller ball in front of the original ball,
to make a ring.  Use a different color for the second ball.

ABG

Scott Ferguson

unread,
Mar 3, 2014, 6:59:07 AM3/3/14
to mitappinv...@googlegroups.com, sw...@teampumpkin.com
You can also overlay your imageSprite with another imageSprite with transparency so the lower imageSprite shows through.
Also, you can make the ball sprite translucent color that you can see through to the imagesprite below with the make color block which takes 3 or four list items to make the color. The fourth item is alpha transparency and you could set it to 128 for 50% transparent.
Eg. set mycolor to make color <make a list (255,0,0,128) => red ball with 50% transparency
---
Scott
Reply all
Reply to author
Forward
0 new messages