TRMG's Recent Forum Activity

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • It doesn't get too much simpler. With Alextro's you can still drag through the walls, and it may not work well for long shapes. If you tried the code I posted it would stop at walls but would snag on them and not slide.

    For sliding here are two different ways. The first moves horizontally then vertically a step at a time. Sliding works very well for unrotated walls.

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

    The second just pastes in the wall slide events I've used elsewhere with some other capx's. It's surprisingly modular I must say. Anyways, it requires putting an imagepoint at the corners of the walls, but the end result is smooth wall sliding.

    https://www.dropbox.com/s/251tpcwb6mg0u ... .capx?dl=0

    Alight then, thanks!

  • ... haha i hate drag and drop too!!

    too many variables to make it work perfect.

    I can help to u if u upload a simple capx.

    Cheers.

    Use my method: how-do-i-set-drag-bounds-for-a-sprite_t122964?&start=10&hilit=drag

    This is a start:

    Global number x0

    Global number y0

    Global number x1

    Global number y1

    Start of layout

    --- set x0 to Sprite.x

    --- set y0 to Sprite.y

    Every tick

    --- set x1 to Sprite.x

    --- set y1 to Sprite.y

    --- Sprite: set position to (x0,y0)

    --- Sprite: set angle towards (x1, y1)

    Repeat distance(x0,y0, x1,y1) times

    --- Sprite: move forward 1 pixel

    ------ Sprite: is overlapping wall

    --------- stop loop

    --------- Sprite: move forward -1 pixels

    Every tick

    --- set x0 to sprite.x

    --- set y0 to Sprite.y

    That will stop the Sprite at walls when being dragged. Having it slide against the walls is more deluxe. There are a few examples around the forum. Not exactly simple but there may be other ways.

    Oh wow, didn't expect it to be this difficult... Is there a simpler way of doing it?

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

  • bump...

TRMG's avatar

TRMG

Member since 4 Dec, 2015

None one is following TRMG yet!

Connect with TRMG

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies