dop2000's Forum Posts

  • citron2010 alastair gave a good explanation of why people use a global sprite for storing variables. There's also an addon for that purpose.

    As for JSON, I use it to store values that are needed rarely. For example, I might add a key like 'MenuNotificationShown' to JSON. There's no point in creating a separate variable for this since I only access it once in the project.

    It's also easy to save all these values at once in Local Storage - just use Sprite.AsJSON and JSON.ToCompactString

  • Each condition (value range) of the same variable will get his own result.

    If the COUNT variable is between 0 and 5, the HUD expresses X.

    If the COUNT variable is between 6 and 15, the HUD expresses Y.

    Another way to do this is with ternary operator:

    TextHUD set text to ((count>=0 & count<=5) ? "X" : (count>=6 & count<=15) ? "Y" : "Z")

  • Scale Outer or Scale Inner modes will dynamically resize the viewport to screen size. But it's your job to make sure that the game properly fills the viewport - that the backgrounds are stretched, that the UI is correctly positioned etc.

  • I have two objects for "global stuff" - a sprite (invisible, global) and JSON. The sprite is for variables I use often, and JSON for everything else.

    The sprite also has Tween, Timer, and LineOfSight behaviors, so I can run occasional timers/tweens or cast a ray when needed.

  • Why do you need the SwordStuck variable at all? Just use Sword.count expression

  • System compare two values Sword.count>10
    System pick Sword instance number 0: Sword destroy
    
  • Looks like when you don't pick LOS or Player instances, the engine will try to process them in pairs. I vaguely remember seeing or reading about this before. I'd say this is a bug, you can try reporting it. Here is a simpler repro:

  • You can add another row (at Y=0), fill it with random numbers. And then use "Sort X".

    I have an old demo:

    howtoconstructdemos.com/sorting-2-dimensional-array-by-any-column-capx

  • A container would've certainly explained this behavior..

    Are events 9-11 nested under some parent event or function?

    Can you reproduce this issue in a small project and share it?

    Of course, the correct way to achieve the same result would be adding "For each Player, Player pick child PlayerLOS" to event #11

  • You have two "Set dx" actions. The second one should be "Set dy"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound Still if the target moves slowly, the scope will be lagging behind and never reach it. I tried to make a sort of predictable aim - position the scope slightly in front of the target - but couldn't make it right.

  • The replace() expression replaced one substring with another. The {name} tag in my example is just the substring which will be replaced. It is not related to the Name variable in any way. You can use the word "banana" instead and it will work just the same.

    Global string s=Hello, banana!
    
    Set s to replace(s, "banana", playerName)
    
  • I believe you can do this with MoveTo behavior - set something like speed=200, acceleration=100, deceleration=50. And on every tick move the scope to the object position.

  • You can't use &Name& in declared variable.

    You can add your own tags, for example {name}, and then replace them with variables.

    Global string Name=Pete
    Global string Greeting=Hello {name}!
    
    Set Greeting to replace(Greeting, "{name}", Name)