- Home /
Remove a part of image on mouse click ?
I am making a cake pop party type of game. And need to eat the saved textures piece by piece. just want to know how to implement this feature. clicking on the image removes a part of image where the mouse clicked. I am stuck and any direction in this regard would be helpul.
thanks in advance.
I havn't seen this game, can you provide screenshot? At a guess, your 'cake' will actually be several pieces arranged to look like one cake object, and each piece would have 2 textures, one for uneaten and one for eaten. Then when you click on a part of the 'cake', it knows which piece is chosen, and if it is eaten or not.
http://www.youtube.com/watch?v=uD5qZWe6qyw
check this link...
suggest you read the easily-available unity documentation for "Input" dealing with mouse clicks and so on. You can work on it from there !
is there masking possible in this context..?? I think i would have 2 use masking as the eating is very random process..
masking? I don't know what you mean but I urge you to read about and start using simple functions like this
http://docs.unity3d.com/Documentation/ScriptReference/Input.Get$$anonymous$$ouseButtonDown.html
and this
http://docs.unity3d.com/Documentation/ScriptReference/Input-mousePosition.html
good luck !
Answer by Anusha · Sep 04, 2012 at 07:33 AM
clicking on the image removes a part of image where the mouse clicked.- this is what u want to do?
well u need to picture ur cake as a puzzle.all the pieces assembled together. U will have to create separate bite pieces and place them together so that it looks like a whole cake.. then if the piece is clicked, destroy it..
Thanks for the valuable advice.. I,m trying to do it like getting the pixels on an area where the mouse is clicked.and then remove it.. Am i on the right track..??
if i understand what you're saying that is quite advanced. you'll have to look in to this:
http://docs.unity3d.com/Documentation/ScriptReference/RaycastHit-textureCoord.html
it's very much more likely that you will just have individual objects, each with their own collider. when the collider is touched, delete it.
I urge you to learn a little but about colliders and start building scenes with objects and colliders!
Thanks Fattie , i think this would help... i would try that....!!
good luck, be sure to start a new queston for any new specific questions that arise!