Help: In-Game Painting

This is different from my other post I made a long time back. I’m trying to make a blend where I can simply paint around like MS Paint, GIMP, Photoshop, etc. Somehow it’s not working. I know a lot of people on here commented around objects being moved along with the mouse and that’s somewhat I’m experiencing with the mouse right now Here’s a picture of the setup for it and the .blend itself. Hope someone can help me out on this! Thanks.

Attachments


PAINTERMAN.blend (335 KB)

Hi Nmaster,

I noticed a couple of problems:

  • The “customMouse.py” script uses deprecated Python methods, which can be updated using the “Convert BGE 2.49” option in the Text Editor (Text -> TextPlugins -> Convert…). But that doesn’t change everything, look at the code I post below. (“own.init”)

  • The code is looking for a property named “init” on the Empty, which isn’t there.

  • The Circle has to be set “Twoside” in the Texture Face Settings in Edit Mode to be visible (?)

  • The Circle has to be on a “hidden layer”, otherwise it says “Warning…” and doesn’t work. The problem is that the other script is looking for the circle on the active layer, so you would have to make two single objects, one as color-indicator and the other as “paint”.

  • When all this changes are made you can draw, but you can draw everywhere. One solution would be giving the plane (drawing area) a property and have the Python Script activate/deactivate drawing if the property is there or not (means if the mouse is over the plane or not). The problem is, that the circles already added when you drew something cover up the plane which would deactivate drawing. So the Circle should also have that property.

  • I would also change “mPosi.raySource” to “mPosi.hitPosition”, the first would return the start point of the sensor ray, the second returns the point where it detects the plane.

Might be a bit confusing, so here’s my revised version of the script:

import Rasterizer as R
cont = GameLogic.getCurrentController()
own = cont.owner
mPosi = cont.sensors["MousePosi"]


### Start mouse position at center of game screen
if own["init"] == 1:    # deprecated: own.init,   updated: own["init"]
    R.setMousePosition(R.getWindowWidth()/2, R.getWindowHeight()/2)
    own["init"] = 0

### Move cursor to mouse position
cursorPosi = mPosi.raySource
own.localPosition = cursorPosi

Hope I could help you,

Jay-D

Yeah,every picture in the game is needed to modify with technology ,I know that,because when I made a website of tera gold ,the picture in it should obey the right feeling of browser,so if you have some problem ,I can get the process of making it through email to you.

Okay I got it to paint now but the brush size is way too big. And one way I know how to not make it cover over the coloring panels is by having that set to an Overlay Scene.

Good idea with the Overlay Scene and the problem with the size should be solved if you use “mPosi.hitPosition” instead of “mPosi.raySource” in the script. That has solved this problem for me.

Jay-D

Ok the overlay and background scene didn’t work out for me at all. Also once I draw something, the color of the stuff I painted keeps changing. Anyway to fix all of this?

Also I really don’t know how to mess around with making a script go from active/deactive.