mindfaQ's Recent Forum Activity

  • Hmm, I tried my suggestion out and at least my implementation wasn't really faster than your methode. So maybe one could do something like:

    set laser to max range -> check for overlap

    pick the nearest of the overlapping objects, substract the maximum distance from any point of the object to the point of origin -> you'll get a value kind of close in front of the object you will be hitting first.

    Then check for overlap again with a while loop (be careful with that, make sure endless loops are not possible), but instead of starting at 2 pixels length, you start near the object you are going to hit, so you'll end up with much less collision checks I think.

  • Export: Browser object -> download string

    Import: File chooser + AJAX object

    When exported to NW.js, there is also the nw.js object to save to files and load them.

    Ob course you can also use a php script to store to or request the string from a database.

  • Hello,

    NW.js exports all assets to the same resources.pak. Is it possible to keep the files separate in a folder? The huge pak file of a large project seems to slow down startup (doesn't react for a quite bit before it opens the window, unlike of smaller projects)

    OR

    how do you go about exporting projects exceeding 1,5 GB filesize? (I'm not having such a project, I'm just asking about possibilities).

  • I was wondering if it is possible to open a PDF or word document in Construct. I am using large amounts of text in my project, and I think this might be most efficient.

    Thanks.

    Most efficient for what? Getting text in your project? I don't think formatted files like doc or pdf are especially good for this.

    I haven't found a working solution to render pdfs in Construct 2, would need a plugin.

  • So parse the array yourself into the format you need, if you can't change it on the other end.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Perhaps pode's awesome plugin:

  • Did you know that there are example projects that come with Construct 2 that show how these behaviors work? Have a look.

  • It already is repeatable, although edward didn't use a family in his example, but I guess you noticed that.

  • The pin-behavior.

  • You could also get a good estimate by calculating the width from the character widths and (either mean or max) spacing/kerning, especially for the sprite font object, I would assume. If you use a monospaced font even easier of course.

    I'm not sure if spritefont behaves like the text object in the way that it only knows the text width and height 1 frame AFTER the text was set. But I have hopes, that it works instantly. It if does, an iterative approach like Rojohound mentioned is probably the easiest way to go about it .

    edit:

    Saw the second post. It looks like it works instantly.

    So you can do this:

    • Spritefont set Scale to 1
    • Spritefont set text to yourtext
    • Spritefont set scale to clamp(spritefont.Width/spritefont.TextWidth,0,1)

    (1 being the zoom factor you want at most)

  • I would probably try:

    1) set laser to max range

    2) check for overlaps

    3) loop over each of the overlapped targets

    4) loop over the lines of the collision polygon of those targets; determine the intersection of the two line segments; if the intersections distance from the shooting point is smaller than localvar_distance (which is initially set at maxrange + 1), save the intersection point to local variables as well as the UID of the hit unit.

    -> after all lines are checked, you will have determined the first collision with your ray, have the x and y of the collision point and UID of the hit unit, in case you wanna know which unit is hit.

    Currently you are doing 50000 collision checks and 7000 poly checks per second for one laser, which is very hefty. With the solution above you would probably do 2 checks (1 for sight, 1 for determining the hit) * amounts of enemy units * 60 fps = 720 checks (current example scene) and then some math calculations, limited to only the objects that could potentially be hit. I think it will be faster.

    One problem is that you can't access the collision polygon coordinates. so you'll have to place image points at the collision polygon points (in an orderly fashion). If you need image points for something else, you will also need a way to determine which image points belong to the collision polygon and which are there for another purpose.

    One way for determining intersections (I haven't tested it myself) can be found here:

    https://lassieadventurestudio.wordpress ... -hit-test/

  • Imo it is not that hard. With which detail are you having problems with?

    You only need to know how to:

    create an object

    tweening / easing an object

    check collision

    use instance variables

    how to use particle effects (but maybe you don't even want those)

    use spritefont for better performance

    The only thing worth noting is that it's probably a smart thing to internally add score immediately and let the score counter behave separately from that.

mindfaQ's avatar

mindfaQ

Member since 12 Oct, 2013

None one is following mindfaQ yet!

Trophy Case

  • 11-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies