mirror of https://github.com/profan/ld-39-jam.git
update bullet, also add particle emitters for sorta thrusters
This commit is contained in:
parent
28a51c47de
commit
f2acd5889d
20
Player.gd
20
Player.gd
|
@ -2,7 +2,9 @@ extends KinematicBody2D
|
||||||
|
|
||||||
onready var sprite = get_node("Sprite")
|
onready var sprite = get_node("Sprite")
|
||||||
onready var camera = get_node("Camera2D")
|
onready var camera = get_node("Camera2D")
|
||||||
onready var particles = get_node("Sprite/Particles2D")
|
onready var left_particles = get_node("Sprite/LeftThruster")
|
||||||
|
onready var right_particles = get_node("Sprite/RightThruster")
|
||||||
|
onready var engine_particles = get_node("Sprite/Engine")
|
||||||
onready var left_gun = get_node("Sprite/LeftGun")
|
onready var left_gun = get_node("Sprite/LeftGun")
|
||||||
onready var right_gun = get_node("Sprite/RightGun")
|
onready var right_gun = get_node("Sprite/RightGun")
|
||||||
|
|
||||||
|
@ -18,6 +20,8 @@ var is_moving = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
set_fixed_process(true)
|
set_fixed_process(true)
|
||||||
|
left_particles.set_emitting(false)
|
||||||
|
right_particles.set_emitting(false)
|
||||||
|
|
||||||
func turn_towards(delta, pos):
|
func turn_towards(delta, pos):
|
||||||
|
|
||||||
|
@ -27,6 +31,18 @@ func turn_towards(delta, pos):
|
||||||
var as = asin(cpd)
|
var as = asin(cpd)
|
||||||
var ca = clamp(as, (-ship_turn_speed) * delta, (ship_turn_speed) * delta)
|
var ca = clamp(as, (-ship_turn_speed) * delta, (ship_turn_speed) * delta)
|
||||||
|
|
||||||
|
left_particles.set_param(Particles2D.PARAM_LINEAR_VELOCITY, 400 * abs(ca))
|
||||||
|
right_particles.set_param(Particles2D.PARAM_LINEAR_VELOCITY, 400 * abs(ca))
|
||||||
|
if ca < -0.01:
|
||||||
|
left_particles.set_emitting(false)
|
||||||
|
right_particles.set_emitting(true)
|
||||||
|
elif ca > 0.01:
|
||||||
|
left_particles.set_emitting(true)
|
||||||
|
right_particles.set_emitting(false)
|
||||||
|
else:
|
||||||
|
left_particles.set_emitting(false)
|
||||||
|
right_particles.set_emitting(false)
|
||||||
|
|
||||||
ship_dir = ship_dir.rotated(-ca)
|
ship_dir = ship_dir.rotated(-ca)
|
||||||
|
|
||||||
func _fixed_process(delta):
|
func _fixed_process(delta):
|
||||||
|
@ -62,4 +78,4 @@ func _fixed_process(delta):
|
||||||
self.move(ship_vel)
|
self.move(ship_vel)
|
||||||
ship_vel = ship_vel / (delta * ship_mass)
|
ship_vel = ship_vel / (delta * ship_mass)
|
||||||
|
|
||||||
particles.set_emitting(is_moving)
|
engine_particles.set_emitting(is_moving)
|
||||||
|
|
50
Player.tscn
50
Player.tscn
|
@ -28,7 +28,7 @@ script/script = ExtResource( 3 )
|
||||||
transform/pos = Vector2( 12.0375, -4.97201 )
|
transform/pos = Vector2( 12.0375, -4.97201 )
|
||||||
script/script = ExtResource( 3 )
|
script/script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Particles2D" type="Particles2D" parent="Sprite"]
|
[node name="Engine" type="Particles2D" parent="Sprite"]
|
||||||
|
|
||||||
transform/pos = Vector2( 0, 13.1031 )
|
transform/pos = Vector2( 0, 13.1031 )
|
||||||
config/amount = 256
|
config/amount = 256
|
||||||
|
@ -53,6 +53,54 @@ params/hue_variation = 0.0
|
||||||
params/anim_speed_scale = 1.0
|
params/anim_speed_scale = 1.0
|
||||||
params/anim_initial_pos = 0.0
|
params/anim_initial_pos = 0.0
|
||||||
|
|
||||||
|
[node name="LeftThruster" type="Particles2D" parent="Sprite"]
|
||||||
|
|
||||||
|
transform/pos = Vector2( -6.55412, -9.38138 )
|
||||||
|
transform/rot = -45.0
|
||||||
|
config/amount = 16
|
||||||
|
config/lifetime = 0.3
|
||||||
|
config/process_mode = 1
|
||||||
|
params/direction = 0.0
|
||||||
|
params/spread = 10.0
|
||||||
|
params/linear_velocity = 60.0
|
||||||
|
params/spin_velocity = 0.0
|
||||||
|
params/orbit_velocity = 0.0
|
||||||
|
params/gravity_direction = 0.0
|
||||||
|
params/gravity_strength = 0.0
|
||||||
|
params/radial_accel = 0.0
|
||||||
|
params/tangential_accel = 0.0
|
||||||
|
params/damping = 0.0
|
||||||
|
params/initial_angle = 0.0
|
||||||
|
params/initial_size = 1.0
|
||||||
|
params/final_size = 1.0
|
||||||
|
params/hue_variation = 0.0
|
||||||
|
params/anim_speed_scale = 1.0
|
||||||
|
params/anim_initial_pos = 0.0
|
||||||
|
|
||||||
|
[node name="RightThruster" type="Particles2D" parent="Sprite"]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 6.55411, -9.31712 )
|
||||||
|
transform/rot = 45.0
|
||||||
|
config/amount = 16
|
||||||
|
config/lifetime = 0.3
|
||||||
|
config/process_mode = 1
|
||||||
|
params/direction = 0.0
|
||||||
|
params/spread = 10.0
|
||||||
|
params/linear_velocity = 60.0
|
||||||
|
params/spin_velocity = 0.0
|
||||||
|
params/orbit_velocity = 0.0
|
||||||
|
params/gravity_direction = 0.0
|
||||||
|
params/gravity_strength = 0.0
|
||||||
|
params/radial_accel = 0.0
|
||||||
|
params/tangential_accel = 0.0
|
||||||
|
params/damping = 0.0
|
||||||
|
params/initial_angle = 0.0
|
||||||
|
params/initial_size = 1.0
|
||||||
|
params/final_size = 1.0
|
||||||
|
params/hue_variation = 0.0
|
||||||
|
params/anim_speed_scale = 1.0
|
||||||
|
params/anim_initial_pos = 0.0
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|
||||||
anchor_mode = 1
|
anchor_mode = 1
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 99 B |
Loading…
Reference in New Issue