Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. ///Initialize Variables
  2.  
  3. enum state
  4. {
  5. on_ground,
  6. in_air,
  7. on_wall,
  8. }
  9.  
  10. player_state = state.in_air;
  11.  
  12. jumping = false;
  13.  
  14. jump_frames_after = 0;
  15. jump_frames_after_duration = 2; //how many frames after the player is falling he can still jump. greatly improves gamefeel because the human brain doesn't work in pc frames
  16.  
  17. jump_frames_before = 0;
  18. jump_frames_before_duration = 6; //how many frames before landing the player can push the jump button so that the jump gets executed as soon as he hits ground. same reason as above
  19.  
  20. jump_height = 10;
  21. additional_jump_height_by_running = 0.3; //additional height is h_speed multipied with this number
  22. additional_jump_height_by_holding = 1; //the higher the number the faster you fall back to earth
  23.  
  24. double_jump = 1;
  25. double_jump_delay_amount = 4; //how many frames the player has to be in air until he can doublejump. the player almost certainly doesn't want to press the double jump immediately after jumping
  26. double_jump_delay_timer = double_jump_delay_amount;
  27.  
  28. wall_jump_distance = 6; //sets current max speed
  29. wall_jump_height = 12; //sets vertical speed to minus that number
  30.  
  31. stuck_to_wall_frames_amount = 8; //how many frames the player is sticking to a wall when jumping onto it
  32. stuck_to_wall_timer = 0;
  33.  
  34. fall_off_wall_delay_amount = 8; //how long you need to press in opposite direction to fall off from a wall
  35. fall_off_wall_delay = fall_off_wall_delay_amount;
  36.  
  37. wall_sliding_speed = 3; //how fast youre falling when sliding down on a wall
  38. free_fall_speed = 15; //24 //how fast youre falling when not sliding down on a wall
  39. max_drop_speed = free_fall_speed;
  40.  
  41. g = 1; //amount of gravity
  42. g_direction = 270; //gravity direction (not implemented yet anywhere)
  43.  
  44. acceleration_on_ground = 0.8;
  45. acceleration_in_air = 1.4; // most importantly changes the wall jump arc
  46.  
  47. friction_on_ground = 8; //how much speed you will lose per step when on ground and not pressing in that direction
  48. friction_in_air = 0.4; //how much speed you will lose per step when in air and not pressing in that direction
  49.  
  50. target_max_speed = 7; //the "normal" horizontal speedlimit
  51. current_max_speed = target_max_speed; //current_max_speed is always getting closer to target_max_speed e.g. after changing it on a slope
  52.  
  53. h_speed = 0; //actual current horizontal speed for the player
  54. v_speed = 0; //actual current vertical speed for the player
  55. h_speed_excess = 0;
  56. v_speed_excess = 0;
  57. h_speed_final = 0;
  58. v_speed_final = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement