dop2000's Forum Posts

  • I think you need to disable unbounded scrolling in layout properties.

  • So you need to smoothly change the parallax from 0% to 50% for example? You can use lerp, but it needs to run on every tick:

    Every tick: Set layer "foo" parallaxX to lerp(LayerParallaxX("foo"), 50, dt*2)

    It may be easier to use Tween behavior - add it to any object, ran a value tween from 0 to 50. While it's running, set layer parallax to tween value. With tween you will be able to choose different easing functions, which is not possible with lerp.

    I'm not sure what can be done about "pixel perfect".

  • Can someone confirm that Create and Destroy are asynchronous actions? I did not expect that.

    No, they are not. "Wait for previous action" in this case works similar to "Wait 0" - it delays the execution until the end of the tick. But I don't recommend using "Wait for previous action" like this, because in some rare cases it may actually wait for some other async action to finish.

    The problem with Create and Destroy actions is that they are not performed instantly. Until the end of the event or end of the tick object counters may not be updated, and other events (or functions you call) may not be aware of the created or destroyed instances.

    There are a few ways to work around it:

    1. Add "Wait 0" after Create action. This will delay until the end of the tick, so use with caution as it may break the logic.

    2. Pick newly created instance by UID or using "System Pick Last Created" condition.

    3. Use the next top-level event to update the counters.

  • Using the layout name in the function call sadly won't help me because I also have a Pause menu that appears in most layouts. Some layouts have both the pause menu and another menu.

    I think you can still use that system. Say, if the game is paused, try to call function inputPressed_layoutname_PauseMenu

    If it doesn't exist (catch branch in the script) - call inputPressed_Common_PauseMenu

  • Speaking of controls, in our game I collect inputs from different devices (keyboard, mouse, gamepad, touch), and have a bunch of functions which mimic Keyboard/Gamepad conditions and return 0/1 value:

    One benefit of this approach is that these functions can be used in complex expressions, for example:

    Functions.OnKeyPressed("Confirm") | (Functions.OnKeyPressed("Use") & Player.isFlying=0)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I miss the flexibility of old functions. I used similar callback-style functions in C2 projects.

    I think the nearest solution with C3 function is to use some universal naming system for them and call them by name. For example, you can have functions inputPressed_layoutname:

    inputPressed_Level1

    inputPressed_Level2

    inputPressed_Menu

    Then you can call the function for current layout using a bit of scripting:

    try { runtime.callFunction("inputPressed_"+runtime.layout.name, localVars.keyCode) }
    catch(e) {}
    
  • The easiest solution is to use TiledBackground for axis objects, set their width to 1000000 pixels and hope players won't reach the end :)

    Here is an example of infinitely scrolling bg:

    dropbox.com/scl/fi/pzwcxbqkpcbf2tova7pjt/InfiniteParallaxBG.capx

    Also, you need to use delta-time when you are moving objects, or they will move at different speeds on different framerates. Replace "Move 3 pixels" with "Move 180*dt pixels"

  • Ruskul Could you report it?

    Looks like "Pick children" condition is the culprit. Disabling "for each child" doesn't make much difference.

    Damn, this is awful.. I just checked - we have over 500 "Pick children" events in our project. This can explain some weird performance problems in the game.

  • I love hierarchies too, this should definitely be reported. I hope Ashley will fix it in LTS version.

  • Check out these examples:

    howtoconstructdemos.com/category/slide-bar

    Note, that for volume you'll need to use log10() expression:

    dropbox.com/scl/fi/5e5kyap5eqq6g7u1kfksb/VolumeSlider.c3p

  • Also how do I do I define "valid locations" since the map will evolve the valiud locations will also change.

    You will have to refresh the array with valid locations. Use a function to clear and re-populate the array. Call this function every time the map evolves.

  • Yes, right-click on the layout in the project view (the panel on the right) -> Copy. Right-click in another project -> Paste.

    Be careful though, if there are different objects with the same name in both projects, the whole thing may not copy correctly.

  • Hierarchy is really useful for tentacles because it syncs both position and angle down the chain. If you rotate the top part of the tentacle 5 degrees, the middle part 3 degrees and the bottom part 1 degree, the bottom part will actually rotate 5+3+1=9 degrees. And all three parts will stay connected.

    You can use Sine or Tween to randomize their movement.

  • Try stopping all tweens on collision.

    You can also connect PlayerBox and Player with a hierarchy in layout editor, then you won't need to update player position on every tick. And do the same for other moving objects.