TRMG's Forum Posts

  • bump...

  • Hey, I got this object that spawns a single sprite object multiple times and places them at the end of the chain.

    img:

    The object has an instance variable (called "ID") which is set to the previous highest value + 1 (so the first will have a value of 1, the second 2 and so on)

    Now, after each instance of the object is created, I want to create a Physics "revolute joint" between the newly created one and the previous one, but I don't know how to select them in one action...

    I have seen some solutions on the forum involving multiple families and adding each object to a family, but as I don't know how many chain objects there will be, I don't think it'll work.

    So, is there any way of making it work?

    Thanks in advance!

  • >

    > > TRMG

    > >

    > > This is one way:

    > >

    > > https://www.dropbox.com/s/fr1qu5w0n6s3gbt/CollideWall.capx?dl=0

    > >

    > Oh also, do you know of a way to get the X and Y position of that collision?

    >

    Hi TRMG, I haven't tried it myself but on this links, they talk about it and they have some nice Capx Examples I hope it helps.

    1: https://www.scirra.com/forum/collision-point_t148607

    2: https://www.scirra.com/forum/how-do-i-get-coordinates-of-collision_t162238

    3: https://www.scirra.com/forum/viewtopic.php?f=147&t=153479&p=967445&hilit=collision#p967445

    Awesome! Thank you very much!

  • TRMG

    This is one way:

    https://www.dropbox.com/s/fr1qu5w0n6s3gbt/CollideWall.capx?dl=0

    Oh also, do you know of a way to get the X and Y position of that collision?

  • Hey, I've got this chain that I'm making wider every tick the player is pressing the left mouse button. Thing is, I want it to stop when it's collided with another object.

    I made this code and it works, but only if there's only one instance of that object in the layout. If there are more it doesn't...

    Here's a capx: https://www.dropbox.com/s/h8j1m37tdt4pc ... .capx?dl=0

    Do you guys have any idea how to do this?

    Thanks!

  • The in-built control options for physics objects will do the job (like friction, mass, etc) but if it needs to be more aggressive then you will need to measure the current vector and velocity of your object, and apply a negative force.

    You should be able to get a good slow-down effect though just my messing around with the basic settings for your object

    ~Sol

    I tried them and it linear damping did the job.

    Thanks!

  • Hey,

    I've got this object that has a physics behaviour attached to it and I'm applying a force to it when I'm pressing the space bar and I'd want it to slow down gradually over time as I'm not pressing the space bar.

    How can I do this?

    Thanks!

  • and event, double click the sprite and under physics go compare velocity and then in the dropdown box there you can set to overall velocity, or whatever you may need.

    Sorry I suck at explaning things

    1am on a Saturday night my brain is...'elsewhere' xD

    Great, thank you very much!

  • You could try setting it so it only applys the impulse if the sprite is moving below a certain speed,

    Something like..

    [ sprite.physics.overallvelocity < 100 ] Apply impulse 1 at X angle

    There doesn't seem to be an overall velocity attribute...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't change the angle of gravity with physics, other then setting world gravity for say 10 to -10 would do up and down but no left and right.

    This may help you though, it's setting impulse in the chose direction to simulate gravity.

    http://s000.tinyupload.com/?file_id=805 ... 2220495075

    This seems like a good solution, but is there a way to set a maximum on that force?

    Because right now it seems to be getting faster and faster as time goes on which is not quite how gravity works...

    Thanks!

  • Hey, I want it when I press the up arrow to make the gravity be upward instead of downward, left arrow to make it go leftward and so on.

    How can I do this?

  • Oops you're right, there are no quotes.

    [quote:3v19xi17]X

    Y

    XAt(index)

    YAt(index)

    XForID(id)

    YForID(id)

    Return the current position of a touch in layout co-ordinates. It changes to reflect scrolling and scaling. However, if an individual layer has been scrolled, scaled or rotated, these expressions do not take that in to account - for that case, use the layer versions below. The At expressions can return the position of any touch given its zero-based index, and the ForID expressions return the position of a touch with a specific ID.

    Great, thank you!

  • Hey, I have this ball which I drag with one finger and I want it to set it's angle towards the second touch when it's being pressed.

    This is the code I use:

    nth touch (1) is touching --> Ball - set angle towards position (Touch.X, Touch.Y)

    Problem is, it's setting the angle towards the first touch.

    So, how do I set it's angle towards my second touch?

  • Forget drag and drop, try this way.

    https://mega.nz/#!EpE22YLb!Rn2OZ5Bi4-bVFt1_y59qt5RPSrnOIQdaIuV034HibR8

    Cheers.

    Thanks, but it seems like a lot more work than R0J0hound's solution...

    I think I'll go with that one.