jobel's Forum Posts

  • You will also have to create the inverse condition

    >> On key `Shift` is pressed

    `N`is Down

    Otherwise the order in which you press the keys would matter.

    it depends - if you want something only to happen when both are pressed, then yes, but in my case you need to add the modifier first. It's like when you type a capitol letter on a keyboard . You hit SHIFT first, then the letter. If you hit the letter first, the letter is lowercase, hitting the SHIFT after does nothing.

  • yes, put all your objects in a family in order to not have to test each one individually.

  • What do you mean "discover"?

    The Mouse object has CursorOverObject event - just know it will trigger 60 times per second, so add Trigger Once While True if you want it to act like a Trigger.

  • add a KeyIsDown to the condition to OnKeyPressed

    example add 2 conditions to your Event:

    On Key 'N' is pressed

    'Shift' is Down

    This will only Trigger when the player hits N+Shift together

  • ended up making this work..

    again it's "fake physics" under a controlled environment

    After Collision Accelerate by this much:

    (BlueBlock.Bullet.speed * BlueBlock.scale) * (min(50,anglediff(GreenBlock.CustomMovement.MovingAngle, BlueBlock.Bullet.AngleOfMotion)/3))[/code:2phzshzm]
    
    then I have a catch-all that makes sure the GreenBlock doesn't go beyond my top speed of 300 just in case I have a situation where it does add too much accel..
    
    this is all done based on "looks" and watching it for long periods of time.. now THAT is some hacky math!
    
    btw the GreenBlock is the "player" which never changes and has a top speed, so all the other obstacles are based on that constant.
  • yeah I'm not trying to do actual physics calculations.. just trying to get it 'approximate' .. it's a video game, so it doesn't need to be a perfect simulation by any means. The background is moving and the camera is lerped, so there's a high fudge factor. The biggest issue is the one I mentioned where the vectors are similar. I need to add that to my calculation and I'll be fine with it.

  • (VB-VA)·n+j*(j*nmassA+j*nmassB)*n+e*(VB-VA)·n=0?(1+e)((VB-VA)·n)+j*(j*nmassA+j*nmassB)*n=0?j=-(1+e)((VB-VA)·n)1massA+1massB

    yup that's what I figured..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can live with setting the Moving angle of the GreenBlock after a collision to:

    angle(BlueBlock.X,BlueBlock.Y,GreenBlock.X,GreenBlock.Y) - 180[/code:3ak5bxur]
    I just can't figure out how much to accelerate by.
    
    I started with some arbitrary numbers and found some that work for most collisions.  Then I tried to come up with a calculation that would fit those numbers.  Most of it works well.
    
    But it all fails in this one scenario where the BlueBlock is traveling right, and a GreenBlock is also traveling right but is going faster.  When it catches up to the BlueBlock, the move angles are correct, except my calc fails miserably by adding way too much speed to the BlueBlock.  My calculation doesn't account for trajectory.
  • R0J0hound any chance you could recommend something? just curious if this is even doable or if its more complicated than I'm making it.

    I just want to figure out how to take into account the moving angles, speed and how that would effect the 'force' or one-off acceleration.

  • MPPlantOfficial yup already downloaded that old Yann example.. gravity is not needed..just outerspace collisions. I couldn't figure a way to apply it.

    I probably need to use sin and cos.. . just don't know really how...

  • lamar there's no gravity.. just angles and speed - would like to use mass if possible. I have it sort of working without using mass.

    it does NOT work when the collision happen and the objects are going somewhat in the same direction - it just adds all this speed and does not look natural.

    just experimenting for a top down space game..

  • those aren't triggers.. so they are happening 60 times per second..

    are you moving the Target ever? it might be working you just can't see it.

  • I came up against this very thing. I haven't perfected yet, but this is what I've been working with:

    So far I'm only using it for RIGHT/LEFT

    Based on the axis I set the direction state to be either right or left. Then when the player let's go (Axis = 0) check what the state was last.

  • I'm experimenting with some physics-like movement without the Physics Behavior. I'm sure it's been done on here before.. can't find any examples though.

    I'm using basic Behaviors: CustomMovement and Bullet. I'm trying to redirect a 'block' based on speed/mass/angle of another block it collides with.

    I need to somehow not add additional speed to the collision. I'm using a one-time Acceleration action like 'force'.. although that may be a bad idea? not sure. All I really care about is the CustomMovement one.. the Bullet one I might just destroy and therefore not care about that trajectory/speed etc..

    I have to somehow take the speed of each object and it's angle to determine the force..since force cancellation would happen if angling directly toward each other - but also if going in slightly the same angle the only force would be the difference in speed. No idea how to do that.

    Maybe I am oversimplifying this... maybe there's a physics behavior for a reason?

    any help?

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