Having trouble with gravity

This forum is currently in read-only mode.
  • Is there a way to add Gravity to a sprite so that it attracts other things?

  • Try Linkman2004's Gravitation plugin

    Should be what you are looking for.

  • I should have searched "Gravitation" Instead of "Gravity".

    Thanks, this is exactly what I was looking for.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You might try testing out the Custom movement behavior. Its got just about everything you would need to simulate gravity, as well as physics.

  • You might try testing out the Custom movement behavior. Its got just about everything you would need to simulate gravity, as well as physics.

    I have been trying to figure out how to use physics and custom movement for this for a week now.

    It does not make much sense to me.

  • Using the custom movement plugin, simply "accelerate" (through the custom movement --> set speed action) towards whatever point you want. It's possible to simulate complex gravity behaviour (eg, multiple points of gravity) with this method.

    Edit: Here's an example where using families, you can achieve this:

    + System: For each spaceyobject
    -> Projectile: Accelerate speed : spaceyobject.Value('Mass')/((distance(spaceyobject.X,spaceyobject.Y, Projectile.X, Projectile.Y))^2) towards spaceyobject 
    [/code:2mq84cok]
    Where you can have multiple objects with the family attribute "spaceyobject". The projectile will accelerate towards "spaceyobjects" according to the equation: (mass (arbitrary private variable held by all spaceyobjects))/(distance from projectile to object^2)
    
    Because this occurs for each spacey object, you can achieve quite realistic (within reason) behaviour. You'll need "mass" values of somewhere around 25,000.
  • Using the custom movement plugin, simply "accelerate" (through the custom movement --> set speed action) towards whatever point you want. It's possible to simulate complex gravity behaviour (eg, multiple points of gravity) with this method.

    Edit: Here's an example where using families, you can achieve this:

    > + System: For each spaceyobject
    -> Projectile: Accelerate speed : spaceyobject.Value('Mass')/((distance(spaceyobject.X,spaceyobject.Y, Projectile.X, Projectile.Y))^2) towards spaceyobject 
    [/code:1och7wgt]
    Where you can have multiple objects with the family attribute "spaceyobject". The projectile will accelerate towards "spaceyobjects" according to the equation: (mass (arbitrary private variable held by all spaceyobjects))/(distance from projectile to object^2)
    
    Because this occurs for each spacey object, you can achieve quite realistic (within reason) behaviour. You'll need "mass" values of somewhere around 25,000.
    

    I feel like an idiot.

    When I added custom movement to a sprite, and saw there were no options to change, I assumed it was not ready yet. Never occurred to me that they were all assignable actions.

    Guess this is why I could never understand programming languages.

    Thank you so much, while this does not affect my gravity issue just yet (as I will have to figure out how this all works), it has allowed me to set up movement the way I want.

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