pckhoi's Forum Posts

  • 5 posts
  • <font size="6">Sentry</font>

    able to 'see' other object but can't see through walls.

    <font size="6">Download</font>

    Extract to Construct 2\exporters\html5\plugins

    <font size="6">Example</font>

    A sentry cast rays from it's position in a cone, and is able to 'see' other objects with it's rays. The number of rays can be set as well as angle of view and length of each ray. The rays will be visible in the editor but not in game. Sentry can not see an object if it is hidden behind a blockade (can be wall, crate, etc).

    <font size="5">cautions:</font>

    • you must call 'Initialize' action for each sentry object at 'On Start Layout'
    • you must add all blockade objects at 'On Start Layout'
    • if your sentry has defined blockades, you must call 'Search for Blockade' action at 'Every Tick' before calling it's 'See other object' conditions.
    • Every time you change the sentry's position or angle, you must call it's 'Recalculate rays' action. Don't have to do so for other parameters.

    If this confuses you, just look at the example. It's pretty straight forward.

    This plugin is a success but it has not been useful for my purpose so I won't be updating it any time soon. If you fix or improve any part of it, you should post it on your own thread and link to this topic I suppose.

  • Nice rewrite of 'is overlapping'. It seem to me that 'is overlapping' and 'on collision' is so very similar in purpose. Both test for overlap and pretty much pick the same set of instances. Maybe the difference lie in the flow of conditions in an event block?

  • I'm missing a ray casting plugin that can act like a sentry being able to "see" another object from a distance. If it's just this I could just use a collision box but the catch is the sentry can't see through certain objects.

    So what I do is I cast many rays from the eye of sentry and see if any ray can "see" the subject but is not blocked half way. The angle of view for each sentry can be tweaked as well as number of rays and the length of each rays.

    What I end up with is usually a shape that could be enclosed in a bounding box. And for efficiency, I try to test collision with the bounding box first before I test intersection with each rays. That's why it's very similar to On Collision.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the timely reply :). So as I understand it, return true mean we run this event and return false mean we don't? So what does retriggering do? Does it run the condition all over again or just plain run the action?

    I basically do a ray casting plugin that has condition very similar to 'OnCollision'. What do you suggest I use then (if not static condition)?

  • I was tinkering with my own plugin and I looked at some conditions from the Sprite plugin and some of the code looks kinda odd to me. Specifically in the IsOverlapping and OnCollision condition:

    • why does it sometime return false and the above comment say that "We've already run the event by now." Did the condition failed? If not then what does false mean?
    • sometime it returns "lsol.instances.length". I guess this will traslate into false or true? Same as above I don't understand why the need to return this. Maybe there is some deep unexplained structure here?
    • sometime there is a "runtime.pushCopySol" call which I can't find reference anywhere what it suppose to do.

    I'm trying to do something similar to collision checking with my plugin so I have to wrap my head around these conditions. Any assistance or alternatives would be greatly helpful.

  • 5 posts