linkman2004's Forum Posts

  • My equation assumes the projectile is moving at a constant velocity, but your bullet is accelerating. The following updated equation should get you what you need.

    timeTaken = abs( (sqrt(2 * distance(attackerX, attackerY, Token.X, Token.Y) * acceleration + initialSpeed^2) - initialSpeed) / acceleration )[/code:3hyecwtn]
    [code:3hyecwtn]animationSpeed = numberOfFrames / timeTaken[/code:3hyecwtn]
    Your code looks fine as far as implementing the equation I gave you.  You should check your animation and make sure each frame has a speed of 1, as higher or lower values could throw things off.  It could additionally be an issue of timing differences.  I've given you mathematically exact equations, but simulations like these aren't necessarily mathematically ideal.
  • The following equation should get you the exact amount of time taken for the projectile to reach its destination.

    timeTaken = abs((sqrt(2 * y_1 * g - 2 * y_0 * g + (sin(theta) * speed)^2) - sin(theta) * speed) / g)[/code:4pq98oc2]
    Where:
    [ul]
    	[li]y_0 is the starting y coordinate of the projectile[/li]
    	[li]y_1 is the y coordinate of the projectile's target[/li]
    	[li]g is the acceleration of gravity in pixels per second[/li]
    	[li]theta is the angle between the ground and the initial direction of the projectile[/li]
    	[li]speed is the initial speed of the projectile[/li]
    [/ul]
    The following equation should get you the required animation speed of the projectile.
    
    [code:4pq98oc2]animationSpeed = numberOfFrames / timeTaken[/code:4pq98oc2]
    This will work for a side view where the projectile start and end positions lie at separate Y coordinates.  If you're talking about a top down view, the following(much simpler) equation should get you what you need.
    
    [code:4pq98oc2]animationSpeed = numberOfFrames / (distance(projectileStartX, projectileStartY, projectileEndX, projectileEndY) / projectileSpeed)[/code:4pq98oc2]
  • I'd suggest taking a look at my Magicam plugin -- it supports following multiple objects, and can even set the layout zoom to keep all of them on screen. It should help with the question in your other thread, as well.

    If you install the plugin, I highly suggest you study the included example before asking any questions -- a lot of what you'll need to know will be in there.

    As mentioned, there's another thread about UE4 already. If you want to ask your question there -- and be civil about it -- you're free to do so.

    I'm locking this thread.

  • You shouldn't have to set the window size to the layout size, and I wouldn't recommend doing that. Try setting the layout scale -- since your layout is three times bigger than the view port, a scale value of 0.3333 should make the whole layout visible.

  • You're using the wrong notation. Take a look at this line:

    player2crosshair.X+Gamepad(1).Axis(0,2)*dt*20[/code:3v9088rx]
    Placing a number n in parenthesis after the object name tells Construct you want to access properties from the nth instance of that object -- you can do this for all object types, and has nothing to do with the Gamepad index.  You're trying to access the Gamepad instance with index 1, which doesn't exist since there's only one instance of the Gamepad object.  The Gamepad index is specified in the first parameter of the "Axis" expression.  So what you actually want is this:
    
    [code:3v9088rx]player2crosshair.X+Gamepad.Axis(1,2)*dt*20[/code:3v9088rx]
    And similar things with the rest of your expressions.
    
    EDIT: Some links for reference:
    [url=https://www.scirra.com/manual/78/expressions]Expressions - See "Object expressions"[/url]
    [url=https://www.scirra.com/manual/143/gamepad]Gamepad manual entry[/url]
  • There are two options as I see it.

    1. Change isActive to a number rather than a boolean and just use 0 and 1 to represent false and true, respectively.

    2. Add another condition to event 7 along these lines:

    System: Compare two values: choose(0, 1) = 1[/code:22aacxjv]
    Which will choose randomly from 0 and 1, if the value is 1, then the condition is true and your Spot's isActive boolean will toggle.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't help but feel that families aren't the best thing to use here. It sounds more like you want a container. Here's the manual entry for containers -- I'd highly suggest reading up and playing around with them.

  • The collision polygon on your "RightWalk" animation, frame 0 is really wonky and doesn't cover most of the object. Open that frame, right click in the image editor, and click "Guess polygon shape". This should get you a square for your collision polygon and clicking the object will be way easier.

  • You can resize the image once it's loaded into Construct 2, by adjusting Sprite size, for example. Because of that, if you use Photoshop to make your graphics, it's generally recommended that you make them large enough for the largest resolution you plan to support. So if your game is targeting 1920 x 1080 at the highest, then you might make your title screen the same size and then scale it down for smaller resolutions.

  • It stands for "Not a Number", implying that your high scores are invalid numbers. Which tutorial were you following? It's possible that the source of your high scores lacks actual score information, or has numbers represented as strings.

  • To be clear, are you wanting the object to point in the same direction as the stick? Or do you want it to rotate counter-clockwise when the stick is held left, clockwise when held right, something along those lines?

    EDIT: If it's the former, here's an example where the object faces the direction of the stick and the position of the stick is limited. I made no assumptions about which side of the sprite is which, so you may need to adjust its angle by plus or minus 90 degrees.

  • Try posting your capx and specifying which tutorial you were following. You haven't given enough information for us to figure out why it's not working.

  • UPDATE: I just realized you said layer scaling, not layout scaling, which my original info referred to. Refer to the manual entry for touch. X and Y don't adjust for layer scaling/rotation/what have you unless you give it a layer as a parameter. For example:

    Touch.X(0)
    Touch.Y(0)[/code:msahtfiz]
    Gives you adjusted touch coordinates for layer 0.
    
    As for the number length, you absolutely should not worry about that.  There's no extra work processing a high precision number like that vs. a rounded number, so long as internally they're stored as the same type(which they almost certainly are).
  • Just type their name preceded by the "@" symbol, like so - Vegamon007