AllanR's Forum Posts

  • Wow! you are right!

    it might have something to do with the new functions... I need to run some more tests to make sure I know whats going on.

    thanks for the file - and for humouring me! :)

  • I'm guessing you didn't take a look at the example I posted (based on your file).

    I do it the way you say should work - and it doesn't, until you add a wait. Try it - click the no wait button, then click the clear button, then click the wait button.

    in the pseudo code you posted, the "On Start Of Layout" is the top level event. Any objects created by actions under it will not be pickable until all the actions in that event are complete and the next top level event starts. The functions don't count as top level events because they are called from the same "on Start of Layout" event. However, having two "On Start of Layout" events would work:

    on Start of Layout - createLevel

    on Start of Layout - loadEnemies

    post a sample showing me that I am wrong. I don't think you can - I have seen this issue cause a lot of trouble, so fully understanding how objects are created and how the eventsheet works is really important.

  • I saved it in the last stable... so try this:

    https://www.rieperts.com/games/forum/wingman.c3p

  • I just tried a couple things with my sample and both worked...

    either make another "Glow" sprite the colour you want

    or add the Tint (or SetColor) effect and set that to the desired colour.

  • well, I guess the only option I can think of would be to have two darkness layers. one below the ground for the sun/moon light, and then one above the ground for any foreground lighting.

    I am not 100% clear on what you want it to look like, so if that suggestion won't work then make a sample image showing what you are after - or a sample project to play with.

  • that would be a picking issue. each knob has to pick the correct slider before it can be aligned properly.

    lerp is a lot like clamp, you give it a start point, and an end point, and then what percentage of the way between the two it currently is.

    so when the percentage is zero, it will be at the start point, at 100% it will be at the end point, at 50% it will be half way between the two.

  • ok, the darkness can stay above the ground, maybe just move the sky to the bottom.

    see this example I made several months ago...

    the moon is on the bottom layer, but has a light on the darkness (MaskLight) layer. the torches, player and fireflies all have their own light too...

    https://www.rieperts.com/games/forum/LightMask.capx

  • ok, then there should be no problem to move the sky and darkness levels to the bottom.

    normally, the bottom layer is set to not be transparent, so make it transparent. And then set the sky layer to not be transparent...

    are there other reasons why you don't think you can move the layers? 300 events isn't too bad to fix issues to make it do what you want!

  • I remember following that thread :)

    the first function will completely execute before the second one, but since they are both called from the same top level event, the objects will not have completed the creation process.

    I took your sample file and added a couple buttons - one to call the two functions without a wait, and one to call with a wait. (and a third to clear the board)

    without a wait the spFloor.Count is zero, and the Pick All fails because there is nothing to pick yet.

    with the wait, calling the same functions, it works just the way you expect it to work.

    https://www.rieperts.com/games/forum/TileTest.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • a good rule of thumb is to always reference layers by name instead of the number - just so you can add or move layers without trouble...

    how many events do you have? it might be easier to replace all layer references with a name

  • have the sky (sun/moon) and darkness layers behind (lower than) the ground layer.

  • the wait 0 is critical to making it work. without the wait 0, the tiles will not have finished the process of being created when the CreateEnemies function is called. it is not a bug, Ashley has said it is a "feature" of the way objects gets created in Construct and to change it would cause too much trouble.

    with the wait 0, the tiles will be fully created and can be picked the way you want.

  • calling a function is no different than copy and pasting those actions into the place where the function is called (except the function doesn't know what objects were picked when it was called). But the actions in the function can still only pick objects that were available to be picked at the point it was called, so it is really still part of the same top level event even though you divided it into two functions.

    if you want the tiles to be fully created when you add the enemies, then the enemies must be created in a separate top level event.

    so, if you don't want to do:

    AJAX on complete - call function CreateLevel; wait 0; call function CreateEnemies;

    then use a GameState variable:

    AJAX on complete - Set GameState to "CreateLevel";

    System GameState = "CreateLevel" - call function CreateLevel; Set GameState = "CreateEnemies"

    System GameState = "CreateEnemies" - call function CreateEnemies; set GameState = "LevelReady"

  • I made a quick test...

    the square button doesn't try to evenly distribute the wingmen at all - just randomly creates them.

    the circle button evenly spreads them apart.

    there are textboxes to enter the number of wingmen you want, and the offset from the cruiser...

    https://www.rieperts.com/games/forum/wingmen.c3p

  • you can get from a position on one layer to that position on another layer using "LayerToCanvasX" and then "CanvasToLayerX"

    so, you might want to put image points on your Sun-Moon...

    it was easier to make a sample than try to explain it.

    https://www.rieperts.com/games/forum/sunmoon.c3p

    the sun/moon are on the "Game" layer because the free edition only allows 2 layers, but you should get the idea.