linkman2004's Forum Posts

  • The "Close" action in the "Browser" object should close the game even when exporting to desktop using Node Webkit.

  • Make sure you've installed the latest graphics drivers for your hardware, as this could be related.

  • This a very complex problem with often times very complex solutions, though there's nothing technically stopping you from implementing such a system in C2. It would probably be of some benefit to look at tutorials for video game AI in general -- not specifically for C2, as the important concepts are separate from implementation.

    A simple system might keep track of the player's recent moves and make decisions based on that. More complex systems may use an artificial neural network to learn and adapt.

  • It's likely you have too many large images, by dimensions instead of size on disk. Images are uncompressed when they're loaded into memory, so you can have a 1024x1024 image that's 10KB as a PNG, but when uncompressed and loaded into memory, that image will be 4MB.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Speed is a magnitude, so negative values probably won't work. You can see this with other behaviors such as the bullet behavior, as well.

  • I've deleted your other thread -- please don't create multiple threads asking the same thing.

  • Just give the bullet behavior a negative acceleration value, which will slow it to zero over time. Alternatively, set the object's speed(from the bullet behavior) to something like this:

    Object.Bullet.Speed - RateOfDeceleration * dt[/code:1obkleai]
    The behavior doesn't seem to allow negative speeds, so this more or less stops at 0, though things seem to get wonky when it hits that point, so you may clamp that value between 0 and some absurdly high value.
  • jobel The original formula given here is assuming the turret is situated at (0, 0), so you need a modified formula that takes into account the turret's position. Here's a modified formula:

    function aimAngle(turret, target, bulletSpeed) {
        var adjustedX = target.x - turret.x;
        var adjustedY = target.y - turret.y;
        var rCrossV = adjustedX * target.vy - adjustedY * target.vx;
        var magR = Math.sqrt(adjustedX^2 + adjustedY^2);
        var angleAdjust = Math.asin(rCrossV / (bulletSpeed * magR));
    
        return angleAdjust + Angle(turret.x, turret.y, target.x, target.y);
    }
    
    NOTE: adjustedX^2 == adjustedX * adjustedX, ^ is the power operator.[/code:29wly5il]
  • I wouldn't recommend that solution, as it only works for numbers with a fixed number of digits. I'd suggest using RegexReplace instead, demonstrated by the following expression:

    RegexReplace(str(MyNumber), "\B(?=(\d{3})+(?!\d))", "g", ",")[/code:m8pi3te3]
    Regular expression comes from a [url=http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript]similar question[/url] on StackOverflow.
  • You can add effects to entire layouts. Select a layout and look for the "Effects" section in the properties pane.

  • In event 18, there's probably some ambiguity about which peasant objects are involved causing the issue. Adding a "for each peasant" loop to the event may help. Here's an example:

    Pathfinding Once While True

    A Sprite object gets scared every time the mouse gets within 50 pixels, running to the house. They return to their original position after 5 seconds.

  • "Trigger once while true" should work fine for what you're needing. Any event you add it to should run once every time it's conditions go from false to true, so there may be something else going on with your events. Care sharing a capx, or at least a screenshot of your events?

  • You can't set variables by name. I'd suggest using a dictionary, which associates values with string keys, allowing you to achieve what you want.

  • Post your CAPX. It's hard to diagnose performance problems off of this little information.

  • You can't access instance variables on an object -- because it can't be picked -- that has been destroyed, so yes.