mirror of https://github.com/profan/ld-39-jam.git
bad sounds
This commit is contained in:
parent
a8fd5022fc
commit
53abec8107
|
@ -2,6 +2,7 @@ extends KinematicBody2D
|
||||||
|
|
||||||
onready var area = get_node("Area2D")
|
onready var area = get_node("Area2D")
|
||||||
onready var gun = get_node("Ship/Gun")
|
onready var gun = get_node("Ship/Gun")
|
||||||
|
onready var launcher = get_node("Ship/MissileLauncher")
|
||||||
|
|
||||||
var ExplosionEffect = load("res://ExplosionEffect.tscn")
|
var ExplosionEffect = load("res://ExplosionEffect.tscn")
|
||||||
|
|
||||||
|
@ -65,6 +66,9 @@ func _fixed_process(delta):
|
||||||
s_arrive.get_steering(steering)
|
s_arrive.get_steering(steering)
|
||||||
cur_kinematic.update(steering, delta)
|
cur_kinematic.update(steering, delta)
|
||||||
|
|
||||||
|
# pass on velocity
|
||||||
|
launcher.set_velocity(cur_kinematic.velocity)
|
||||||
|
|
||||||
if player_in_cone:
|
if player_in_cone:
|
||||||
gun.fire(delta, cur_kinematic.velocity * delta, cur_kinematic.get_orientation())
|
gun.fire(delta, cur_kinematic.velocity * delta, cur_kinematic.get_orientation())
|
||||||
|
|
||||||
|
@ -73,4 +77,3 @@ func _fixed_process(delta):
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
pass
|
pass
|
||||||
# rotate(grunt_rot_speed * delta)
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=7 format=1]
|
[gd_scene load_steps=8 format=1]
|
||||||
|
|
||||||
[ext_resource path="res://EnemyGrunt.gd" type="Script" id=1]
|
[ext_resource path="res://EnemyGrunt.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://raw/enemy_grunt.png" type="Texture" id=2]
|
[ext_resource path="res://raw/enemy_grunt.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://raw/exhaust.png" type="Texture" id=3]
|
[ext_resource path="res://raw/exhaust.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://Gun.gd" type="Script" id=4]
|
[ext_resource path="res://Gun.gd" type="Script" id=4]
|
||||||
|
[ext_resource path="res://MissileLauncher.gd" type="Script" id=5]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
|
|
||||||
|
@ -69,6 +70,11 @@ params/anim_initial_pos = 0.0
|
||||||
transform/pos = Vector2( 0, 12.2383 )
|
transform/pos = Vector2( 0, 12.2383 )
|
||||||
script/script = ExtResource( 4 )
|
script/script = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="MissileLauncher" type="Node2D" parent="Ship"]
|
||||||
|
|
||||||
|
transform/pos = Vector2( 1.3176, 15.4159 )
|
||||||
|
script/script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
input/pickable = true
|
input/pickable = true
|
||||||
|
|
|
@ -40,9 +40,15 @@ func _ready():
|
||||||
s_seek.set_target(player)
|
s_seek.set_target(player)
|
||||||
s_arrive.set_target(player)
|
s_arrive.set_target(player)
|
||||||
|
|
||||||
|
player.on_enemy_missile_lock(self)
|
||||||
|
connect("exit_tree", player, "on_enemy_missile_lock_lost", [self])
|
||||||
|
|
||||||
# base death timer on lifetime
|
# base death timer on lifetime
|
||||||
death_time = ps.get_lifetime()
|
death_time = ps.get_lifetime()
|
||||||
|
|
||||||
|
func set_velocity(vel):
|
||||||
|
cur_kinematic.velocity = vel
|
||||||
|
|
||||||
func on_impact(e, is_bullet):
|
func on_impact(e, is_bullet):
|
||||||
|
|
||||||
# create bullet impact
|
# create bullet impact
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var Missile = load("res://Missile.tscn")
|
||||||
|
|
||||||
|
var launch_timer = 0
|
||||||
|
var launch_delay = 5 # 5 seconds
|
||||||
|
var velocity = Vector2(0, 0)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
set_process(true)
|
||||||
|
|
||||||
|
func set_velocity(vel):
|
||||||
|
velocity = vel
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
launch_timer += delta
|
||||||
|
if launch_timer >= launch_delay:
|
||||||
|
var new_missile = Missile.instance()
|
||||||
|
var missile_pos = get_global_pos()
|
||||||
|
new_missile.set_global_pos(missile_pos)
|
||||||
|
get_tree().get_root().add_child(new_missile)
|
||||||
|
new_missile.set_velocity(velocity)
|
||||||
|
launch_timer = 0
|
46
Player.gd
46
Player.gd
|
@ -7,6 +7,7 @@ onready var right_particles = get_node("Sprite/RightThruster")
|
||||||
onready var engine_particles = get_node("Sprite/Engine")
|
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")
|
||||||
|
onready var audio = get_node("SamplePlayer")
|
||||||
|
|
||||||
var mov_speed = 64 # pixels per second
|
var mov_speed = 64 # pixels per second
|
||||||
var ship_vel = Vector2(0, 0)
|
var ship_vel = Vector2(0, 0)
|
||||||
|
@ -17,6 +18,12 @@ var ship_dir = Vector2(1, 0)
|
||||||
var ship_mass = 61
|
var ship_mass = 61
|
||||||
|
|
||||||
var is_moving = false
|
var is_moving = false
|
||||||
|
var missiles_locked_on = 0
|
||||||
|
var is_engine_playing = false
|
||||||
|
var enemy_missiles = Array()
|
||||||
|
|
||||||
|
var bleep_timer = 0
|
||||||
|
var bleep_delay = 0.5
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
set_fixed_process(true)
|
set_fixed_process(true)
|
||||||
|
@ -32,6 +39,16 @@ func do_damage(v):
|
||||||
func get_kinematic_position():
|
func get_kinematic_position():
|
||||||
return get_global_pos() + ship_vel
|
return get_global_pos() + ship_vel
|
||||||
|
|
||||||
|
func on_enemy_missile_lock(m):
|
||||||
|
enemy_missiles.append(m)
|
||||||
|
missiles_locked_on += 1
|
||||||
|
|
||||||
|
func on_enemy_missile_lock_lost(m):
|
||||||
|
enemy_missiles.erase(m)
|
||||||
|
missiles_locked_on -= 1
|
||||||
|
if missiles_locked_on <= 0:
|
||||||
|
audio.stop_all()
|
||||||
|
|
||||||
func turn_towards(delta, pos):
|
func turn_towards(delta, pos):
|
||||||
|
|
||||||
var target_dir = (pos - get_global_pos()).normalized()
|
var target_dir = (pos - get_global_pos()).normalized()
|
||||||
|
@ -55,6 +72,14 @@ func turn_towards(delta, pos):
|
||||||
|
|
||||||
ship_dir = ship_dir.rotated(-ca)
|
ship_dir = ship_dir.rotated(-ca)
|
||||||
|
|
||||||
|
func get_closest_missile_distance():
|
||||||
|
var min_dist = 1000
|
||||||
|
for m in enemy_missiles:
|
||||||
|
var mis_dist = get_global_pos().distance_to(m.get_global_pos())
|
||||||
|
if mis_dist < min_dist:
|
||||||
|
min_dist = mis_dist
|
||||||
|
return min_dist
|
||||||
|
|
||||||
func _fixed_process(delta):
|
func _fixed_process(delta):
|
||||||
|
|
||||||
var mov_delta = Vector2(0, 0)
|
var mov_delta = Vector2(0, 0)
|
||||||
|
@ -79,6 +104,27 @@ func _fixed_process(delta):
|
||||||
elif Input.is_action_pressed("player_switch_down"):
|
elif Input.is_action_pressed("player_switch_down"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# get closest enemy missile, calc distance
|
||||||
|
var closest_missile_dist = get_closest_missile_distance()
|
||||||
|
|
||||||
|
if closest_missile_dist == 1000:
|
||||||
|
bleep_delay = 0.5
|
||||||
|
else:
|
||||||
|
bleep_delay = closest_missile_dist / 1000
|
||||||
|
|
||||||
|
bleep_timer += delta
|
||||||
|
if missiles_locked_on > 0 and bleep_timer > bleep_delay:
|
||||||
|
if closest_missile_dist > 10:
|
||||||
|
audio.play("friendly_blip")
|
||||||
|
bleep_timer = 0
|
||||||
|
|
||||||
|
if is_moving and not is_engine_playing:
|
||||||
|
is_engine_playing = true
|
||||||
|
# audio.play("engine")
|
||||||
|
elif not is_moving:
|
||||||
|
is_engine_playing = false
|
||||||
|
# audio.stop(0)
|
||||||
|
|
||||||
set_rot(ship_dir.angle())
|
set_rot(ship_dir.angle())
|
||||||
|
|
||||||
var new_vel = (ship_vel + (mov_delta * (delta * ship_accel))).clamped(ship_max_vel)
|
var new_vel = (ship_vel + (mov_delta * (delta * ship_accel))).clamped(ship_max_vel)
|
||||||
|
|
56
Player.tscn
56
Player.tscn
|
@ -1,10 +1,14 @@
|
||||||
[gd_scene load_steps=11 format=1]
|
[gd_scene load_steps=16 format=1]
|
||||||
|
|
||||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://img/player_ship.tex" type="Texture" id=2]
|
[ext_resource path="res://img/player_ship.tex" type="Texture" id=2]
|
||||||
[ext_resource path="res://Gun.gd" type="Script" id=3]
|
[ext_resource path="res://Gun.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://raw/exhaust.png" type="Texture" id=4]
|
[ext_resource path="res://raw/exhaust.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://ThrusterScript.gd" type="Script" id=5]
|
[ext_resource path="res://ThrusterScript.gd" type="Script" id=5]
|
||||||
|
[ext_resource path="res://sounds/engine.wav" type="Sample" id=6]
|
||||||
|
[ext_resource path="res://sounds/friendly_blip.wav" type="Sample" id=7]
|
||||||
|
[ext_resource path="res://sounds/select_blip.wav" type="Sample" id=8]
|
||||||
|
[ext_resource path="res://sounds/warning_beep.wav" type="Sample" id=9]
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=1]
|
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||||
|
|
||||||
|
@ -31,6 +35,39 @@ points = Vector2Array( 3.76748, 13.2396, -2.6136, -3.10647, 1.0577, -3.01906 )
|
||||||
custom_solver_bias = 0.0
|
custom_solver_bias = 0.0
|
||||||
points = Vector2Array( 13.645, 9.30603, 3.76748, 13.2396, 5.42831, -1.44565, 13.7324, 0.302593 )
|
points = Vector2Array( 13.645, 9.30603, 3.76748, 13.2396, 5.42831, -1.44565, 13.7324, 0.302593 )
|
||||||
|
|
||||||
|
[sub_resource type="SampleLibrary" id=6]
|
||||||
|
|
||||||
|
samples/engine = {
|
||||||
|
"db": 0.0,
|
||||||
|
"pitch": 1.0,
|
||||||
|
"priority": 0,
|
||||||
|
"sample": ExtResource( 6 )
|
||||||
|
}
|
||||||
|
samples/friendly_blip = {
|
||||||
|
"db": 0.0,
|
||||||
|
"pitch": 1.0,
|
||||||
|
"priority": 0,
|
||||||
|
"sample": ExtResource( 7 )
|
||||||
|
}
|
||||||
|
samples/select_blip = {
|
||||||
|
"db": 0.0,
|
||||||
|
"pitch": 1.0,
|
||||||
|
"priority": 0,
|
||||||
|
"sample": ExtResource( 8 )
|
||||||
|
}
|
||||||
|
samples/warning_beep = {
|
||||||
|
"db": 0.0,
|
||||||
|
"pitch": 1.0,
|
||||||
|
"priority": 0,
|
||||||
|
"sample": ExtResource( 9 )
|
||||||
|
}
|
||||||
|
samples/warning_beep2 = {
|
||||||
|
"db": 0.0,
|
||||||
|
"pitch": 1.0,
|
||||||
|
"priority": 0,
|
||||||
|
"sample": ExtResource( 9 )
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D"]
|
[node name="Player" type="KinematicBody2D"]
|
||||||
|
|
||||||
transform/scale = Vector2( 2, 2 )
|
transform/scale = Vector2( 2, 2 )
|
||||||
|
@ -224,4 +261,21 @@ polygon = Vector2Array( -7.7709, -11.5854, -7.94572, -1.096, -16.075, 0.215181,
|
||||||
shape_range = Vector2( 0, 4 )
|
shape_range = Vector2( 0, 4 )
|
||||||
trigger = false
|
trigger = false
|
||||||
|
|
||||||
|
[node name="SamplePlayer" type="SamplePlayer" parent="."]
|
||||||
|
|
||||||
|
config/polyphony = 2
|
||||||
|
config/samples = SubResource( 6 )
|
||||||
|
default/volume_db = 0.0
|
||||||
|
default/pitch_scale = 1.0
|
||||||
|
default/pan = 0.0
|
||||||
|
default/depth = 0.0
|
||||||
|
default/height = 0.0
|
||||||
|
default/filter/type = 0
|
||||||
|
default/filter/cutoff = 5000.0
|
||||||
|
default/filter/resonance = 1.0
|
||||||
|
default/filter/gain = 1.0
|
||||||
|
default/reverb_room = 2
|
||||||
|
default/reverb_send = 0.0
|
||||||
|
default/chorus_send = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ name="ld-39"
|
||||||
main_scene="res://Game.tscn"
|
main_scene="res://Game.tscn"
|
||||||
icon="res://icon.png"
|
icon="res://icon.png"
|
||||||
|
|
||||||
|
[audio]
|
||||||
|
|
||||||
|
stream_buffering_ms=100
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
player_attack_secondary=[mbutton(0, 2)]
|
player_attack_secondary=[mbutton(0, 2)]
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6a2b9870a06f63aeea7016ea621baf7d7896aa974a61a640ef94322f2492c305
|
||||||
|
size 16346
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:09b3e4def7edd2f3ae3384c96f34bc458313062f20fb90cd656449bd81ebc7e5
|
||||||
|
size 599234
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:88e33c3af46722266533f8677d412265fc01692ccbf2b6130e74c2e68fdf374b
|
||||||
|
size 15602
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6a2b9870a06f63aeea7016ea621baf7d7896aa974a61a640ef94322f2492c305
|
||||||
|
size 16346
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b3fb0714ad978aa82afdd4c4a04f6fb76a2197193aec0879be0ae415c4050530
|
||||||
|
size 452582
|
Loading…
Reference in New Issue