How do I Create a Paint Game [SOLVED]

0 favourites
  • 14 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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...

  • 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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Hi

    i can get this to work with touch control?

  • nelsonamen What's the problem? Simply replace in events:

    On Left Mouse button clicked -> On any touch start

    Left mouse button down -> Is in touch

    Mouse.x, Mouse.y -> Touch.x, Touch.y

  • dop2000dont work correct

  • "On Left button clicked" -> replace with "On any touch start" (not with "Is in touch")

    "Is Left button down" -> replace with "Is in touch" (not with "On touch start")

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