how to trow a object to a image point?

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hi all,

    I was wondering how to trow a object to a enemy's image point? (my case it's the enemy's head)

    Is this posible? and if... how?

    I can't use bullet behavior for it in my case, I use Physics to trow rocks.

    Thanks in advance for any reply

  • How is the rock thrown, arcing or straight?

    For straight you could turn off gravity and just apply force toward the direction of the target.

    Arcing however I do believe will prove more of a problem

  • [quote:37dfea1x] How is the rock thrown, arcing or straight?

    For straight you could turn off gravity and just apply force toward the direction of the target.

    its arcing and its not posible I think

    but thanks for the reply

  • I need to trow a rock in a arc from player to enemy and that it hits his head, need this option when the players XP in aim is high, so that you get a instant hit at enemy head, it doesn't matter anymore if I need bullit or psycics behavior for it.

    anyone?

  • Calculating an arc like that requires some fairly decent math knowledge. Here is a little interactive Flash presentation on game physics that might point you in the right direction (the stuff about arcs is towards the end):

    http://www.rodedev.com/tutorials/gamephysics/

  • [quote:2eocllhg] Calculating an arc like that requires some fairly decent math knowledge. Here is a little interactive Flash presentation on game physics that might point you in the right direction (the stuff about arcs is towards the end):

    http://www.rodedev.com/tutorials/gamephysics/

    Thanks Deadeye, this link is verry helpfull to understand how to calculate this kind of things

  • Great information indeed, but forgive me if I'm missing something, but isn't the question really... "how do I do this in Construct?" And if so, how would you translate that information that's written in a language programming environment to Construct which is an event-based programming environment which inherently requires steps, input techniques and understandings that differ pretty much entirely from those found in the language programming environment used as an example in the flash video?

  • You can do it with one event with the physics behavior. Change the PV 't' to change how long in seconds it takes to get to the target.

    http://dl.dropbox.com/u/5426011/examples4/projectile2.cap made in 0.99.97

  • Nice, I don't understand it, but 9.8 looks like Earth's gravity, that means...no still don't understand it:). Thanks for sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:2jfe552q] You can do it with one event with the physics behavior. Change the PV 't' to change how long in seconds it takes to get to the target.

    http://dl.dropbox.com/u/5426011/example ... ctile2.cap made in 0.99.97

    Thanks ROJOhound, this is really what I need, a conctruct expample

    It's awesome how you do that with only 1 event, don't understand either the logic of this formule but thats more because my low mathematic skills.

    Thanks again for this example

  • You can do it with one event with the physics behavior. Change the PV 't' to change how long in seconds it takes to get to the target.

    http://dl.dropbox.com/u/5426011/examples4/projectile2.cap made in 0.99.97

    Hey Rojohound,

    That .cap is great. I've never used the Physics behavior in Consruct before and I was wondering... is there a way to make the thrown object move to another object the same way as your example, but instead by using a single 360 button or PC keyboard command instead of using the mouse to set an angle?

    For example: I press 'A' on the 360 controller and the ball arcs to object A. I press 'B' and the ball arcs to object B, and so on and so forth.

    I've been able to activate the ball movement based on a mouse left click and set the ball's angle to the position of the target, but I'm having trouble changing the expression in the velocity equation to do what my example above describes.

  • The mouse isn't setting the angle, it's setting the target (or the location to arc to).

    To target a different object just replace "mousex" and "mousey" with the object's x and y.

  • The mouse isn't setting the angle, it's setting the target (or the location to arc to).

    Right. My mistake, I meant to say arc.

    To target a different object just replace "mousex" and "mousey" with the object's x and y.

    The expression is where I'm stuck. I want to be able to throw the object with a controller button and have the arc's size only be based on how far the distance the ball being thrown is from the object being thrown to. For example:

    01 ======= 02

    ^^^

    The 01 represents the object the ball is being thrown from. 02 represents the object that will catch the ball. Because the distance is short the arc will be short.

    01 ============================================= 02

    ^^^ In this one, since the distance is longer the arc will be higher.

    Here is all I was able to get up to:

    <img src="http://farm6.static.flickr.com/5148/5687138761_da25ea522d_z.jpg">

  • How could it (arc throwing) be done without physics, as the example doesn't work in the latest C build.

  • It works with the latest if you also get lucid's physics fix (in the same thread) and uncheck and check "Use old units".

    You can also do it with just events:

    http://dl.dropbox.com/u/5426011/example ... ctile1.cap

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)