Seeking some clarification on Containers.

  • Hi all.

    I'm hoping someone can give me some clarification of what I am doing wrong or, not implementing to get my 3 objects that are in a container, behaving correctly.

    Within the container I have.

    1. The root object.This object moves the other 2 objects around via an "Every tick, set to position". That works just fine.

    2. An "Aiming object". This behaves like a turret, and rotates towards a single target.

    3. The actual sprite, this is a 40 frame animation, kind of like an RTS Sprite rounded to 9 decree increments, based on the angle of the "Aiming object" (number 2)

    Here's 2 issues I have been having, and I hope someone will be kind enough to give me some solutions and explanations, just so I don't repeat similar mistakes or misunderstandings.

    Q1 : The rotations of the aiming object were flickering intermittently to various angles, and the Z order of these objects was also behaving strangely, until I added a "for each root object" within the function that rotated them.

    I was under the assumption that each spawned container group could not interfere with another? What was causing this?

    Q2 : When these object reach a specific Y coordinate, I wanted them to fire a bullet based on the rounded angle of the Aiming object, however, if I use a "Trigger once while true" , it only affects the first container group, and none of the subsequent container groups fire anything. Can anyone explain why the "once while true" function only affects the 1st object spawned??

    Thanks, as always.

  • Q1: it's hard to say what was the problem without seeing your events.

    If you were changing the angle of the aiming object without picking root object first, then no wonder it was affecting all aiming objects.

    Q2: "Trigger once" condition does not work per object or per container. After the first object reached Y coordinate (and stays there), this event will not be triggered again when other objects reach the same coordinate.

    Instead of "Trigger once" you should add an instance variable "bulletIsFired" to your object, set it to true when it reaches Y. And use it as a second condition to prevent firing again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 Thanks (yet again)- I will try that ASAP..

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