linkman2004's Recent Forum Activity

  • I don't think this expression does what you think it does:

    angle(monster.X, monster.Y, random(360), random(360))[/code:edvl1pbf]
    This is getting the angle between your monster position and a random point with X and Y coordinates not exceeding 360.  All parameters for the angle() expression represent coordinates, not angles.
    
    Replace the previous expression with this expression and you should have pieces properly flying in random directions:
    
    [code:edvl1pbf]random(360)[/code:edvl1pbf]
  • Nesteris, that's the idea. The Construct Classic version of the plugin was capable of this, so that's what I'm shooting for.

  • purplemonkey, I haven't had any issues with this. If you could provide a CAPX, I'll take a look and see what's up.

    Nesteris, I've been meaning to get around to adding this for a while, but haven't found the time. Perhaps by the end of May.

  • Since you can't get the angle of lines making up collision polygons, you'll have to manually find it, as I've demonstrated in the included example.

    Essentially, it finds the contact points for the bottom-left and bottom-right corners of the vehicle, then gets the angle from the X-axis to the line formed by those points. You'll want to pay close attention to the origin and image point locations of the vehicle. It would be reasonably trivial to adjust the positions of these -- requires some small adjustments to vehicle and detector positioning -- but as it is, this should provide the most accurate fitting to the road.

    Note: The example has no terminating condition in the case that you drive off the edge and the detector can't find the ground, so be mindful of that.

    EDIT: Attachment not working, here's a link -> Normal detection example

  • I suggest uploading a capx file illustrating your problem, as it will be hard to diagnose otherwise.

    Projects made with the free version are always limited to 100 events, publishing or not.

  • Z-indices are indeed unique, at least per layer. Though even if they weren't, bladedpenguin's method would likely work all the same.

  • If you're making an infinite runner, you're really going to have procedurally generate your levels -- because they're actually infinite, and it will save you tons of work designing levels. The key is to generate your obstacles in such a way that they don't overlap, which is entirely doable, I'm sure. Provide some more information on your setup, and someone on the forums should be able to help you with that.

    EDIT: As an aside, layout size doesn't appear to be limited to 10000 pixels, so I'm not sure where you're hitting a wall.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Something along these lines should work, which is just the difference between the normal speed of your bullet and the Y speed of your ship.

    adjustedSpeed = BulletSpeed - ship.8Direction.VectorY[/code:jq30vrkd]
    Assumes the ship object has the 8Direction behavior and is facing the top of the screen.  This speed should be given to the bullet upon firing.
  • I assume you're talking about the square showing the window size on the layout view. You can change the window size by clicking on your project in the Projects pane, then finding and changing "Window Size" in the properties pane under "Project settings".

  • 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.

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