Instance drawing

0 favourites
From the Asset Store
You need this package if you want to program a Street Fighter or battle game.
  • Hi folks.

    I'm looking for a way to draw a line which could separated vertically a rectangle.

    To sum up, I want to draw a two cells rectangle.

    For the moment, I just have one rectangle and I didn't find the good documentation to draw more of one.

    Here's my code for now.

    IDEInstance.prototype.OnCreate = function()

    {

         this.instance.SetHotspot(new cr.vector2(0, 0));

    }

    IDEInstance.prototype.OnInserted = function()

    {

         this.instance.SetSize(new cr.vector2(75, 25));

    }

  • Or some keywords to look for ...?

    edit Is it a bug ? My reply send this post to Construct 2 General instead of staying in Construct Engineering...

  • Have a look at the Button or TextBox plugins - they draw rectangles in the editor (but don't draw anything at runtime, it's only for the editor draw code). Does that help?

  • Thanks Ashley but it doesn't.

    I already drew one rectangle, I just want to know how can insert a vertical line inside this first rectangle.

  • It's not a bug I moved it.

    Construct Engineering is more about the programming of Construct-Classic.

    I was wondering about moving it to the plugins section, as it was where it would be likely to be seen by other developpers, and finaly decided to leave it as general C2 discussion for now.

    Have you looked at the manual for the SDK - Edit time ?

    It should contain some valuable help.

  • You can also look at my Spritefont plugin, it's got plenty of draws for both canvas and webgl contexes. Though it only draws rectangles in edittime.

    Well, you can draw another rectangle, except with width of 1.

  • Thanks to all of you.

    I managed to learn more about drawing in the edittime.js.

    Nevertheless, I succeed to draw a new rectangle (with new cr.quad()) but impossible to know how to insert this new rectangle directly into my instance.

    For now, it's drawn directly at its position in the layout.

    Thanks for helping

  • I would love to find a solution by myself, though I find none documentation about drawing method in js.

    I read the sdk and didnt figure out to find an answer to my interrogation.

    It's only for aesthetic of my plugin, which is getting close released, but I spent very much time to search and try a solution.

    Someone has already drawn a separated rectangle (by drawing two rectangles, or maybe separated two fill color by coordinates, ...)

    Thanks

  • The SDK manual has been updated fairly recently, I believe, so you may want to take a gander at it once again, specifically the edit-time page.

    Specifically, you want the renderer.Fill(quad, color). You can create a new quad or use the instance.GetBoundingQuad() to get the instance's quad. You can also use the bounding quad to retrieve instance's corners, angle (calculating it with atan2) and so on.

  • Ashley I don't think that the question was ever asked, but is it possible to draw other thing than a box and a line, I'm thinking especially to a circle ... ?

  • I wrote a tutorial about drawing in edittime, hopefully it'll help.

  • Ashley I don't think that the question was ever asked, but is it possible to draw other thing than a box and a line, I'm thinking especially to a circle ... ?

    Sorry to bump it up but could I have an answer please?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Drawing circles is actually kinda tricky unless you just load a circle texture and draw that. Does that sound OK?

  • Ashley I would love, but you told me that's actually impossible to load texture from disk. (hey, edittime.js ;))

  • Maybe I can add that feature instead then :P

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