Way to make BALL(jacob1's Mod) in Lua?

  • QuentinADay
    24th Sep 2014 Member 0 Permalink

    Is there a way to make a particle move and bounce? (I know how to set vx and vy in Lua but don't know how to make it bounce up and down)

  • jacob1
    24th Sep 2014 Developer 0 Permalink
    You would really have to replicate how I did moving solids in Lua to do this. I set both the velocity and position (x and y) every frame to the correct values, if not it just falls apart. Just setting velocity isn't enough. There should be info on each moving solid in a separate variable and some way for a particle to know which moving solid it is attached to. The way I did it each particle will look for things to bounce off of, and if it finds something it changes the velocity of the ball significantly in the other direction.

    The update function for BALL is here. There is also update_moving_solids here.

    There's also some other code elsewhere to create the moving solids from the brush with the correct properties, and some code in Simulation::Update() to update msvx/msvy. Hopefully all the code is useful and not too complicated.