Drawing system in Renpy?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
nanashine
Regular
Posts: 129
Joined: Thu Nov 30, 2017 1:44 pm
itch: renpytom
Contact:

Drawing system in Renpy?

#1 Post by nanashine »

I was searching for something like a drawing system for Renpy.

So I found this post: viewtopic.php?t=51370
And this code: https://github.com/jsfehler/renpy-freehand-draw

I adjusted a few things, and it works nice.
But there are a few problems.

The first thing is that sometimes when you draw a full circle it doesn't matter if you choose something else, the game keeps only letting you draw the circle.
Another problem is that if your drawing "touches" the edges of the screen, it also "goes crazy". It won't stop drawing straight lines.
And the other problem is that I couldn't make a "undo" button. If the person makes a mistake, they have to draw it all again.

I changed the code a bit, and added more colors. I also made it vertical, since my game is vertical.
I wanted to add another line of colors but I couldn't either :lol: :oops:

Does anyone know how I can fix at least one of those things :oops: :lol:

Here is what I did (project):
https://drive.google.com/open?id=1lDiJC ... kETN88OkwZ

I wanted to add more colors and these options: "undo", "clear", "leave" like that.

Image

Also, I tried changing the images (icons) of the lines, circle, etc. But the game didn't change it :?:
I wanted them to look a little bigger.

Thanks :)
I can't access my other account cause I don't remember the e-mail I used *cries in emoji*.

User avatar
Wight
Regular
Posts: 47
Joined: Mon Jan 07, 2019 5:40 pm
Completed: A Transient Experiment
itch: wight
Contact:

Re: Drawing system in Renpy?

#2 Post by Wight »

I might have an idea why it's not working as expected for you, I've ran into similar issues when changing it around for my NaNoRenO project.
I have some solutions to your issues and only some workarounds.


nanashine wrote: Wed Mar 20, 2019 2:21 pm The first thing is that sometimes when you draw a full circle it doesn't matter if you choose something else, the game keeps only letting you draw the circle.
This happens when you hold down your mouse, and then release it while it's over another button. Let's say doing this confuses the game and makes it think you're trying to use two buttons at once. I can't offer a solution to this, my workaround was to space the buttons far away from the canvas to prevent this from happening.

nanashine wrote: Wed Mar 20, 2019 2:21 pm Another problem is that if your drawing "touches" the edges of the screen, it also "goes crazy". It won't stop drawing straight lines.
It's not a solution, but what I ended up doing was shrinking the canvas by a lot so that the edges of the canvas are far away from the edge of the window.
However, it seems like this is only an issue if you're playing this in windowed mode, fullscreen mode doesn't seem to have this issue as far as I can tell.

nanashine wrote: Wed Mar 20, 2019 2:21 pm And the other problem is that I couldn't make a "undo" button. If the person makes a mistake, they have to draw it all again.
I couldn't figure out how to get this working either. The player just has to use the white color as an eraser to fix an error.
The way it draws is really simple and limited anyway. With the way it's set up right now, I'd only expect doodles to be made and nothing too serious. There's real drawing programs the player can use for serious art.
nanashine wrote: Wed Mar 20, 2019 2:21 pm I wanted to add another line of colors but I couldn't either
You'll probably need to make a second hbox for this one.
nanashine wrote: Wed Mar 20, 2019 2:21 pm Also, I tried changing the images (icons) of the lines, circle, etc. But the game didn't change it
Your new icons are in a subfolder. Which means you either need to make the new icons overwrite the current ones, or change the code to look for "Nova pasta/pencil_icon.png" instead.

For those last two issues, I edited your script file to fix it and included a few #notes:
script.rpy
(4.85 KiB) Downloaded 18 times
And for comparison's sake, this is how I made it look in my version.
https://i.imgur.com/sKdRGXm.png
It still has some of the same issues you do that I couldn't solve, but I find that it's far less likely to happen when set up like this. I don't know how important it is for you to keep it that big, but you might have to consider shrinking down the canvas by a lot.

nanashine
Regular
Posts: 129
Joined: Thu Nov 30, 2017 1:44 pm
itch: renpytom
Contact:

Re: Drawing system in Renpy?

#3 Post by nanashine »

Wight wrote: Thu Mar 21, 2019 4:16 am I might have an idea why it's not working as expected for you, I've ran into similar issues when changing it around for my NaNoRenO project.
I have some solutions to your issues and only some workarounds.


nanashine wrote: Wed Mar 20, 2019 2:21 pm The first thing is that sometimes when you draw a full circle it doesn't matter if you choose something else, the game keeps only letting you draw the circle.
This happens when you hold down your mouse, and then release it while it's over another button. Let's say doing this confuses the game and makes it think you're trying to use two buttons at once. I can't offer a solution to this, my workaround was to space the buttons far away from the canvas to prevent this from happening.

nanashine wrote: Wed Mar 20, 2019 2:21 pm Another problem is that if your drawing "touches" the edges of the screen, it also "goes crazy". It won't stop drawing straight lines.
It's not a solution, but what I ended up doing was shrinking the canvas by a lot so that the edges of the canvas are far away from the edge of the window.
However, it seems like this is only an issue if you're playing this in windowed mode, fullscreen mode doesn't seem to have this issue as far as I can tell.

nanashine wrote: Wed Mar 20, 2019 2:21 pm And the other problem is that I couldn't make a "undo" button. If the person makes a mistake, they have to draw it all again.
I couldn't figure out how to get this working either. The player just has to use the white color as an eraser to fix an error.
The way it draws is really simple and limited anyway. With the way it's set up right now, I'd only expect doodles to be made and nothing too serious. There's real drawing programs the player can use for serious art.
nanashine wrote: Wed Mar 20, 2019 2:21 pm I wanted to add another line of colors but I couldn't either
You'll probably need to make a second hbox for this one.
nanashine wrote: Wed Mar 20, 2019 2:21 pm Also, I tried changing the images (icons) of the lines, circle, etc. But the game didn't change it
Your new icons are in a subfolder. Which means you either need to make the new icons overwrite the current ones, or change the code to look for "Nova pasta/pencil_icon.png" instead.

For those last two issues, I edited your script file to fix it and included a few #notes:
script.rpy

And for comparison's sake, this is how I made it look in my version.
https://i.imgur.com/sKdRGXm.png
It still has some of the same issues you do that I couldn't solve, but I find that it's far less likely to happen when set up like this. I don't know how important it is for you to keep it that big, but you might have to consider shrinking down the canvas by a lot.
Oh, thank you so much for all the explanation.
Since my game simulates a phone, I thought that would be nice to add this as a "tool".
I'll give a look at the code.
Thank you :)
I can't access my other account cause I don't remember the e-mail I used *cries in emoji*.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]