Drawing Primatives

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Are there any ways to draw lines? Could someone show me how to create a function in python that does drawline((x1,y1), (x2,y2))?

  • Construct comes with a line object and the canvas object has a action to draw lines.

  • I guess I will have to experiment with Line. The exposed interface isn't very intuitive.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What are you trying to do? If you're trying to connect two objects with a line, the Line object is the way to go, since all you have to do is update its start and end position. If you want to draw a picture consisting of many lines, you probably want to use the Canvas object, which is better suited to procedural drawing.

  • I want to be able to do all of the above. I'm not really clear on what the canvas object does. Would you have to make it the size of the application window in order to draw anywhere on the screen? Would you be willing to make a cap that demonstrates what you are talking about? I'm sorry if I seem dense but it seems to me to make the line object useful to me I would have to make some python wrapper methods.

  • Maybe the better path to take is describe exactly what you want to do. For example a real project situation, and some of the bright minds here might be able can give you direction.

  • The line object, and canvas object "draw line" work the same. (x1,y1,x2,y2).

    The only difference is line uses window coordinates, and canvas uses its dimensions.

    Thing is there is no way to get correct collision detection with line, but you can with canvas.

    As far as primitives go there's no way to fill in either case. Also Python cant draw directly to the Construct window, you can only make calls to Construct objects, like sprite.

    Sprite BTW can make filled primitives out of a distort map, but there's no collision detection on it, unless you paste it into a canvas.

    Good times.

  • I stole a little time from work and tested it out. I wasn't looking in the right place before. I forget sometimes that most useful actions aren't available until you call them from an even (such as mouse clicked).

    Thanks for putting up with my mental slowness.

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