Improved jetpack implementation.
parent
4f9e5f294f
commit
f49d972c34
|
@ -80,6 +80,8 @@ var jetpack_thrust = 48 # force applied against gravity
|
||||||
var jetpack_tank = 0.5 # maximum fuel (jetpack use time
|
var jetpack_tank = 0.5 # maximum fuel (jetpack use time
|
||||||
var jetpack_fuel = jetpack_tank # current fuel (use time) left
|
var jetpack_fuel = jetpack_tank # current fuel (use time) left
|
||||||
var jetpack_recharge = 0.25 # how long to recharge to full
|
var jetpack_recharge = 0.25 # how long to recharge to full
|
||||||
|
var jetpack_min = 1/4
|
||||||
|
var jetpack_was_active = false
|
||||||
|
|
||||||
var velocity := Vector3.ZERO
|
var velocity := Vector3.ZERO
|
||||||
var gravity_vec := Vector3.ZERO
|
var gravity_vec := Vector3.ZERO
|
||||||
|
@ -225,8 +227,12 @@ func _physics_process(delta):
|
||||||
if Input.is_action_pressed("move_right"):
|
if Input.is_action_pressed("move_right"):
|
||||||
direction += transform.basis.x
|
direction += transform.basis.x
|
||||||
|
|
||||||
jetpack_active = Input.is_action_pressed("move_special") if jetpack_fuel > 0 else false
|
jetpack_was_active = jetpack_active
|
||||||
|
|
||||||
|
if jetpack_was_active:
|
||||||
|
jetpack_active = Input.is_action_pressed("move_special") if jetpack_fuel > 0 else false
|
||||||
|
else:
|
||||||
|
jetpack_active = Input.is_action_just_pressed("move_special") if jetpack_fuel > jetpack_min else false
|
||||||
|
|
||||||
if jetpack_active:
|
if jetpack_active:
|
||||||
gravity_vec[1] += jetpack_thrust * delta
|
gravity_vec[1] += jetpack_thrust * delta
|
||||||
|
@ -234,7 +240,7 @@ func _physics_process(delta):
|
||||||
elif jetpack_fuel < jetpack_tank:
|
elif jetpack_fuel < jetpack_tank:
|
||||||
jetpack_fuel = min(jetpack_tank, jetpack_fuel + jetpack_recharge * delta)
|
jetpack_fuel = min(jetpack_tank, jetpack_fuel + jetpack_recharge * delta)
|
||||||
|
|
||||||
#print("Jetpack fuel: ", jetpack_fuel, " active: ", jetpack_active, " delta: ", delta, " gravity vec: ", gravity_vec)
|
print("Jetpack fuel: ", jetpack_fuel, " active: ", jetpack_active, " delta: ", delta, " gravity vec: ", gravity_vec)
|
||||||
|
|
||||||
if direction.length() > 0: # normalized() will return a null
|
if direction.length() > 0: # normalized() will return a null
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
|
|
|
@ -147,6 +147,15 @@ lifetime = 0.5
|
||||||
fixed_fps = 30
|
fixed_fps = 30
|
||||||
local_coords = false
|
local_coords = false
|
||||||
mesh = SubResource( "QuadMesh_355ks" )
|
mesh = SubResource( "QuadMesh_355ks" )
|
||||||
|
particle_flag_rotate_y = true
|
||||||
|
direction = Vector3(0, -1, 0)
|
||||||
|
spread = 0.0
|
||||||
|
initial_velocity_min = 3.0
|
||||||
|
initial_velocity_max = 3.0
|
||||||
|
damping_min = 10.0
|
||||||
|
damping_max = 10.0
|
||||||
|
angle_min = -180.0
|
||||||
|
angle_max = 180.0
|
||||||
scale_amount_curve = SubResource( "Curve_elwjc" )
|
scale_amount_curve = SubResource( "Curve_elwjc" )
|
||||||
color_ramp = SubResource( "Gradient_fu53v" )
|
color_ramp = SubResource( "Gradient_fu53v" )
|
||||||
anim_offset_min = -100.0
|
anim_offset_min = -100.0
|
||||||
|
|
|
@ -4,7 +4,7 @@ enum GameFocus {MENU, GAME, CHAT, AWAY}
|
||||||
enum NetworkRole {NONE, CLIENT, SERVER, DEDICATED_SERVER, RELAY_SERVER}
|
enum NetworkRole {NONE, CLIENT, SERVER, DEDICATED_SERVER, RELAY_SERVER}
|
||||||
|
|
||||||
const NET_PORT = 12597
|
const NET_PORT = 12597
|
||||||
const NET_SERVER = "localhost" #liblast.unfa.xyz"
|
const NET_SERVER = "liblast.unfa.xyz" #"localhost"
|
||||||
|
|
||||||
var peer = ENetMultiplayerPeer.new()
|
var peer = ENetMultiplayerPeer.new()
|
||||||
|
|
||||||
|
|
Reference in New Issue