Fimbul's Forum Posts

  • Bump: z-ordering with foreach and "send to top of layer" may be just as efficient, but it sure makes a mess out of your code - especially if you have to order several different objects that aren't grouped into a family.

    With number based z-ordering, I can keep track of the numbers myself, and assure there is never a collision (order numbers being equal). Even if there is, construct could draw whatever first (the first one that gets called in the draw loop is behind) without any other special logic to handle such z-order collisions.

    It sounds exactly like the sort of problem a game creating engine should abstract away.

  • don't use img.onload. It either won't fire or it will fire as soon as you change the SRC attribute, and there are no workarounds.

    use img.completed, which is a flag that returns TRUE when the image is loaded. You'd have to check it every tick though. In my "insert external image into sprite frame" plugin (I can't come up with a good name), I use cf_fake_trigger and evaluate that flag every tick.

  • Well, you can also test the distance between objects with events: distance(a.x, a.y, b.x, b.y) < 100

    but I understand that's not very convenient. It's on the todo list, but it gets a bit tricky with things like poly-circle and circle-poly collisions.

    hence the "ugly hack" part (if I were to make this as a plugin)

  • A circular collision mask is the same as calculating distance from the center of the object (you can offset this, obviously).

    If a point's distance relative to your object is less than the radius of the "circle mask" (which isn't really a mask, just an imaginary concept), that point is colliding with the object.

    I could probably make a behavior to make objects "collide" with perfect circle masks, but it would be an ugly hack and it would probably be computationally expensive for multiple objects. PM me if you really need this urgently and can't implement it via events.

  • Distance(ThisObject.X, ThisObeject.Y, ThatObject.X, ThatObject.Y)

    Distance(ThisObject.Point, ThatObject.Point)

    Distance(ThisObject, ThatObject)

    Last one looks cleanter, IMHO.

    If the expression can extract X and Y out of the object, it looks cleaner than the "point" alternative and avoids creating yet another construct.

  • But there will be a way to group different objects, right?

    I can think of a couple situations in which that'd be useful, such as when you want to create/destroy/rotate/move an entire composite object at once.

    It would automatically associate all instances with each other (for instance, a condition that selects one object would include all objects of that group into the SOL).

    That would enable things like a tank emitting smoke particles, complete with a main cannon and a machine gun turret, with a health bar and a player name (for instance).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • security concerns

  • ...snip...

    that won't work. You'll make instant turns.

    You also won't be able to move in one direction while pointing at another (which is something the OP wants to achieve).

    The only way out is to use vectors, or use my behavior which does that for you (plus it's faster, since it doesn't have to interpret events)

  • The spaceship movement is probably what you need. Couple it with the wrap movement and you're gold.

    If you run into any bugs with the behavior, report it in it's thread or PM me.

  • We've added support for custom controls in r51. Should be out on Monday! :)

    So I guess I'll have to make my behaviors compatible then?

  • Maybe you're using bracket notation?

    such as array[1][2]

    if so, it isn't the proper way to use arrays.

    You should use it as array.at(1,2)

    Also, arrays are zero based, and no dimensions should have size zero. If you want a two dimensional array, Z should be 1.

    Without seeing your caproject, I can't say.

  • the expression "get angle of motion" returns the angle in radians, even though it says it will return degrees.

    This gave me a huge headache just now.

  • I'd like an update on this, since it's already "tomorrow".

  • I'm working on a lot of plugins:

    • One saves an area of the canvas as either PNG or JPG, and outputs it as an octet string that you can set as the SRC of an image, or a file you can download.
    • The other attempts to create a "centipede" movement, though I'm not sure how I'll go about making the body sections
    • The other uses predictive aiming to calculate either the angle or X,Y coordinates you need to aim in order to hit a moving object
    • The other loads images dynamically and allows you to replace the frame of an object with the image you just loaded.
    • Another (planned) is a missile movement, where you can have your projectile be guided or not, how sharp a turn it can make, if it preserves inertia or not, and what's its friction (momentum loss over time) or deceleration(if it's not using inertia).

    I like to separate NPC/Object movements from player movements, because it seems more clear that way, so I placed my turret behavior (for instance) in "automatic movements"

  • Since I'm back to plugin dev, I'm always stumped as to what to categorize my plugins as.

    Is there a list somewhere with standard category names for plugins and behaviors, just so we don't have to each invent our on category or stick everything in "general"?