Trying to implement physics from the Sonic Physics Guide... issue

Discussion in 'Fangaming Discussion' started by Travelsonic, Oct 6, 2013.

  1. winterhell

    winterhell

    Member
    1,165
    7
    18
    Do they have to be constants?
    You can have a function that changes the values depending on if you are under of above water and if you are super or not super.
    Well if you are using a pointer to an array and just changing the pointer, then I guess its the same.
     
  2. Travelsonic

    Travelsonic

    Member
    819
    17
    18
    For whatever reason, I thought that it'd be less intensive (and less of a clutter) to have the array swaps (yes, by changing the pointer / I am using ptrs to arrays).

    I mean, unless I am mistaken, the values (friction, accel, deceleration, grav, etc) for above water, underwater movement, and Super Sonic movement in of themselves don't change - just which particular set (Super Sonic, above water, under water, etc) is being used, so I'd figure that I'd do a swap when transitioning from above to under water, from under to above water, when going Super, when losing Super, etc, rather than cluttering my movement function(s)* with additional checks for these things, then acting based on those conditions.

    * Since I broke up my movement into 5 separate functions, one for each of the 4 modes (floor mode wall mode, ceiling mode, and air mode), and one for when sonic dies/drowns. My Sonic object has a var that holds the current mode Sonic is in, and when it comes time to move sonic, the move function called calls one of these 5 functions based on what this variable's value is (= 0 dead mode, 1 = floor mode, 2 = wall mode, 3 = ceiling mode, 4 = air mode)
     
  3. Travelsonic

    Travelsonic

    Member
    819
    17
    18
    EDIT: Nevermind, jesus christ, I gotta stop trying to do this while sleep deprived, I miss so much shit in the guide. -0_0-