Browse Source

[H0] Build jump speed; [H1] Fix error on click

master
Luna 7 years ago
parent
commit
05135ab0a5
2 changed files with 10 additions and 7 deletions
  1. +4
    -2
      scripts/heroes/0.gd
  2. +6
    -5
      scripts/heroes/1.gd

+ 4
- 2
scripts/heroes/0.gd View File

@ -3,6 +3,7 @@ extends "res://scripts/player.gd"
const wallride_speed_necessary = 2
const wallride_leap_height = 14
const wallride_leap_side = 8
const wallride_leap_build = 0.01
var since_on_wall = 0
var last_wall_normal = Vector3()
@ -47,8 +48,9 @@ func wallride(state):
apply_impulse(Vector3(), air_accel * aim[2] * get_mass())
# Allow jumping (for wall hopping!)
if Input.is_action_just_pressed("jump"):
var jump_impulse = wallride_leap_side * last_wall_normal
jump_impulse.y += wallride_leap_height
var build_factor = 1 + switch_charge * wallride_leap_build
var jump_impulse = build_factor * wallride_leap_side * last_wall_normal
jump_impulse.y += build_factor * wallride_leap_height
set_gravity_scale(1) # Jumping requires gravity
state.apply_impulse(Vector3(), jump_impulse * get_mass())
else:


+ 6
- 5
scripts/heroes/1.gd View File

@ -19,11 +19,6 @@ func _process(delta):
# Make a floating placement wall
placing_wall_node = add_wall()
is_placing_wall = true
if Input.is_action_just_pressed("hero_1_confirm_wall"):
finalize_wall(placing_wall_node)
rpc("slave_place_wall", placing_wall_node.get_transform())
placing_wall_node = null
is_placing_wall = false
if is_placing_wall:
# Find the point we're looking at, and put the wall there
@ -35,6 +30,12 @@ func _process(delta):
var up = -aim[2] # Wall should be horizontal to my view
placing_wall_node.look_at(towards, up)
if Input.is_action_just_pressed("hero_1_confirm_wall"):
finalize_wall(placing_wall_node)
rpc("slave_place_wall", placing_wall_node.get_transform())
placing_wall_node = null
is_placing_wall = false
slave func slave_place_wall(tf):
var wall = add_wall()
finalize_wall(wall, tf)


Loading…
Cancel
Save