Improved jetpack implementation.

remotes/1705377932733043820/tmp_refs/heads/unbroken
unfa 2021-09-08 23:54:04 +02:00
parent 4f9e5f294f
commit f49d972c34
3 changed files with 19 additions and 4 deletions

View File

@ -80,6 +80,8 @@ var jetpack_thrust = 48 # force applied against gravity
var jetpack_tank = 0.5 # maximum fuel (jetpack use time
var jetpack_fuel = jetpack_tank # current fuel (use time) left
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 gravity_vec := Vector3.ZERO
@ -225,8 +227,12 @@ func _physics_process(delta):
if Input.is_action_pressed("move_right"):
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:
gravity_vec[1] += jetpack_thrust * delta
@ -234,7 +240,7 @@ func _physics_process(delta):
elif jetpack_fuel < jetpack_tank:
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
direction = direction.normalized()

View File

@ -147,6 +147,15 @@ lifetime = 0.5
fixed_fps = 30
local_coords = false
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" )
color_ramp = SubResource( "Gradient_fu53v" )
anim_offset_min = -100.0

View File

@ -4,7 +4,7 @@ enum GameFocus {MENU, GAME, CHAT, AWAY}
enum NetworkRole {NONE, CLIENT, SERVER, DEDICATED_SERVER, RELAY_SERVER}
const NET_PORT = 12597
const NET_SERVER = "localhost" #liblast.unfa.xyz"
const NET_SERVER = "liblast.unfa.xyz" #"localhost"
var peer = ENetMultiplayerPeer.new()