Browse Source

Clean up tp_camera whitespace; update REAME

master
Luna 7 years ago
parent
commit
f6f7696238
2 changed files with 17 additions and 18 deletions
  1. +5
    -6
      README.md
  2. +12
    -12
      scripts/tp_camera.gd

+ 5
- 6
README.md View File

@ -18,12 +18,12 @@ Side mechanics ideas:
Current heroes:
- Active:
- Wallriding mfer
- INDUSTRIA (Wallriding mfer)
- Offensive:
- WallMAKING mfer
- An ATTRACTIVE mfer
- IRA (WallMAKING mfer)
- LUSSURIA (An ATTRACTIVE mfer)
- Support:
- Margarine
- CARITAS (Margarine)
Ideas for Heroes:
@ -41,7 +41,6 @@ Ideas for Heroes:
- Lay walls
- Lay traps
- Destroy buildings
- Slow in AoE
Key concepts:
@ -54,7 +53,7 @@ Key concepts:
- Fast pace
- From Zineth we take:
- A rethinking of racing games
- High skill cap, low skill floor
- High skill cap, high(=easy) skill floor
- Forgiving gameplay
Running


+ 12
- 12
scripts/tp_camera.gd View File

@ -25,7 +25,7 @@ export(NodePath) var pivot;
func _ready():
cam = get_node(cam);
pivot = get_node(pivot);
cam_fov = cam.get_fov();
func set_enabled(enabled):
@ -46,7 +46,7 @@ func add_collision_exception(node):
func _input(ie):
if !is_enabled:
return;
if ie is InputEventMouseMotion:
cam_pitch = max(min(cam_pitch+(ie.relative.y*cam_view_sensitivity),cam_pitch_minmax.x),cam_pitch_minmax.y);
if cam_smooth_movement:
@ -55,7 +55,7 @@ func _input(ie):
cam_yaw = fmod(cam_yaw-(ie.relative.x*cam_view_sensitivity),360);
cam_currentradius = cam_radius;
cam_update();
if ie is InputEventMouseButton:
if ie.pressed:
if ie.button_index == BUTTON_WHEEL_UP:
@ -70,23 +70,23 @@ func _input(ie):
func _process(delta):
if !is_enabled:
return;
if !cam.is_current():
cam.make_current();
if cam.get_projection() == Camera.PROJECTION_PERSPECTIVE:
cam.set_perspective(lerp(cam.get_fov(), cam_fov, cam_smooth_lerp*delta), cam.get_znear(), cam.get_zfar());
if cam_smooth_movement:
cam_cpitch = lerp(cam_cpitch, cam_pitch, 10*delta);
cam_cyaw = lerp(cam_cyaw, cam_yaw, 10*delta);
cam_currentradius = lerp(cam_currentradius, cam_radius, 5*delta);
cam_update();
func cam_update():
cam_pos = pivot.get_global_transform().origin;
if cam_smooth_movement:
cam_pos.x += cam_currentradius * sin(deg2rad(cam_cyaw)) * cos(deg2rad(cam_cpitch));
cam_pos.y += cam_currentradius * sin(deg2rad(cam_cpitch));
@ -95,9 +95,9 @@ func cam_update():
cam_pos.x += cam_currentradius * sin(deg2rad(cam_yaw)) * cos(deg2rad(cam_pitch));
cam_pos.y += cam_currentradius * sin(deg2rad(cam_pitch));
cam_pos.z += cam_currentradius * cos(deg2rad(cam_yaw)) * cos(deg2rad(cam_pitch));
var pos = Vector3();
if cam_ray_result.size() != 0:
var a = (cam_ray_result.position-pivot.get_global_transform().origin).normalized();
var b = pivot.get_global_transform().origin.distance_to(cam_ray_result.position);
@ -105,13 +105,13 @@ func cam_update():
pos = pivot.get_global_transform().origin+a*max(b-0.1, 0);
else:
pos = cam_pos;
cam.look_at_from_position(pos, pivot.get_global_transform().origin, Vector3(0,1,0));
func _physics_process(delta):
if !is_enabled:
return;
var ds = get_world().get_direct_space_state();
if ds != null:
cam_ray_result = ds.intersect_ray(pivot.get_global_transform().origin, cam_pos, collision_exception);


Loading…
Cancel
Save