linkman2004's Recent Forum Activity

  • Given the following values, you can determine percentage completion as follows:

    StartX - X coordinate of the start line

    CurrentX - current X coordinate of the player

    EndX - X coordinate of the finish line

    Percentage completion: ((CurrentX - StartX) / (EndX - StartX)) * 100

  • Not with a tiled background. If you want a collision shape other than the object's bounding box, you'll have to use a Sprite for the terrain and set its collision polygon accordingly. Information on collision polygons on this page.

  • This is a limit of the free version of the program. See the table here.

  • Try using the browser object's "Is online" condition instead -- "On went online/offline" are triggers that won't run unless the state of the connection changes.

  • Store the current version number in local storage, check against a constant holding the current version number at game launch. If they're different, clear local storage and store the new version number. This ensures clearing the local storage after booting the new version for the first time. A quick example. Change the CURRENTVERSION to test.

  • The drag and drop behavior allows you to limit the axis upon which an object is dragged to strictly vertical -- this is found in the behavior properties. To limit the Y range, every tick you can set the Y position of your Sprite to something like the following:

    clamp(Sprite.Y, LOWBOUND, HIGHBOUND)

    LOWBOUND and HIGHBOUND being whatever you want to limit your min and max Y values to respectively.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The math way:

    Create bullet at: Sprite.X + cos(angle(Sprite.X, Sprite.Y, Mouse.X, Mouse.Y)) * 100, Sprite.Y + sin(angle(Sprite.X, Sprite.Y, Mouse.X, Mouse.Y)) * 100

    You can also store the calculated angle in a local variable so you only have to calculate it once, then substitute that variable into the equations.

  • If you want the position of your sprites to constantly snap to a grid as you drag them, then you can set the position of the sprites every tick to something like this:

    X: round(Sprite.X / TileWidth) * TileWidth

    Y: round(Sprite.Y / TileHeight) * TileHeight

    TileWidth and TileHeight being whatever size you want your grid squares to be.

    Alternatively, if you want smooth dragging, but for the final positions to be snapped to a grid, you can set the sprite's position to the above formula upon the object being dropped.

  • Do you have "Active at start" in your Fade behavior properties set to "No"? If not, it will start fading upon starting the game.

  • I've prepared a quick example to show how this can be done. I'm not sure how you have your object moving, so I set this one up to move at 100 pixels per second along the X-axis and to use the sine behavior on the Y-axis, but the same concepts should apply regardless.

    Sine Facing example

    There's a small bit of calculus involved to get what we want. We start off with our position functions for the object, which are as follows(not Construct 2 expressions, but close):

    X: InitialX + 100t

    Y: InitialY + Magnitude * sin(CycleAngle)

    Take the first derivative to find the velocity:

    Vx: 100

    Vy: Magnitude * cos(CycleAngle)

    Now that we have the velocity, we can use the angle() expression that I outlined in my original post to find the direction of travel. Note that with the sine behavior, Sine.CyclePosition is just the normalized angle used when calculating the oscillation, so we multiply 360 to turn it back into degrees.

    As an additional note, please try to avoid so many posts in a row in the future -- you can always edit new information into your previous post.

  • I'll assume since you're talking about acceleration you mean 1 px/sec^2. If you have direct control over the speed, set it to something along the following lines:

    speed = speed + dt   equivalent to    speed = speed + 1 * dt[/code:b9cuhztl]
    If you're unaware of dt -- short for delta time -- I'd suggest looking at [url=https://www.scirra.com/tutorials/67/delta-time-and-framerate-independence]this useful tutorial[/url].
  • If you have access to the X and Y motion vectors for your object, the angle of motion can be obtained from the expression angle(0, 0, VectorX, VectorY). However, I may be misunderstanding exactly what you're looking for -- a capx or a diagram would be useful.

linkman2004's avatar

linkman2004

Member since 15 Jan, 2008

Twitter
linkman2004 has 1 followers

Trophy Case

  • 16-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

18/44
How to earn trophies