Changeset 68:60aa6c3eb96f


Ignore:
Timestamp:
Apr 3, 2011, 9:05:17 PM (9 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
rebase_source:
f84546c25b76c12e07ff30dbf487f4f98289154d
Message:

Implement bounce factor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/physics.py

    r66 r68  
    1616
    1717    terminal_velocity = (100.0, 100.0) # maximum horizontal and vertial speeds
     18    bounce_factor = (0.9, 0.9) # bounce factor
    1819
    1920    def __init__(self, *args, **kwargs):
     
    6162        frac_y = clip.height / abs(v_y) if abs(v_y) > EPSILON else 0.0
    6263        frac = max(frac_x, frac_y)
     64        b_x = -v_x * self.bounce_factor[0] * immobile.bounce_factor[0]
     65        b_y = -v_y * self.bounce_factor[1] * immobile.bounce_factor[1]
    6366        self.velocity = (-v_x, -v_y)
    6467        self.deltap(frac)
     68        self.velocity = (b_x, b_y)
    6569
    6670
Note: See TracChangeset for help on using the changeset viewer.