How do I Create a Paint Game [SOLVED]

  • Hi, I am trying to create a system similar to MS Paint in Windows. I made this code based on a tutorial, but it does not fill the lines perfectly, nor does it smoothly, does anyone have a solution? Thank you!

    I would like to do something like this video in the matter of the smoothness of the drawing...

    https://youtube.com/watch?v=9wNqnELALy8

  • This is all you do to create a smooth line. You could also create dots as well at (mouse.x, mouse.y). It will become slow over time as the number of objects gets higher. You'll probably want to draw it to a paster object or something.

    global oldx=0

    global oldy=0

    left mouse is down

    --- create line at (oldx,oldy)

    --- line: set width to distance(self.x,self.y,mouse.x,mouse.y)

    --- line: set angle toward (mouse.x,mouse.y)

    every tick:

    --- set oldx to mouse.x

    --- set old.y to mouse.y

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The lines are still flawed... I do not think it will work.

    See if I did it right...

    I would like to learn how to do with Points instead of Lines...

  • I tried to do with dots but it also did not work.

  • Actually it looks like you have the sprite's origin centered. It needs to be on the left.

  • That was it!

    Now we have another problem...

    When I increase the size of the sprites to make a bigger brush, the defects reappear...

    Is there any way to spawn the dots at each end of the line? I think that would solve that question ... What do you think?

  • It's solved!

    Spawn a dot on the left Image Point of the LINE to cover the gap when you sharply change angles.

    Also a little performance, but nothing that compromises too much my goals with the application. Thank you very much!

    Thank you very much!

  • R0j0, you're beautiful for this. i've hit a speedbump though. mine spawns dots intermittently, making an effect almost like an on off toggle for the spawn, always evenly spaced, so its odd. however, it could just be my pc, so i'll send a test run through to the arcade and run it through a virtual machine. however, i see that in this you set oldx and oldy every tick, but then never call on them. ive tried adjusting the origin point to the left as well as spawning on both the old and current x,y and it still seems very spotty. i've copied everything above except the dot1 dot2, as those seemingly just change the current position of 'dot1' and 'dot2' rather than spawning them, so every click it would move, unless im wrong there? idk, if you have a moment, help me out lol. thanks ahead of time.

  • forgive me, im an idiot. fixed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)