mirror of https://github.com/profan/ld-39-jam.git
incredible
This commit is contained in:
parent
39feb442b7
commit
ed53d1b190
|
@ -6,7 +6,7 @@
|
|||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
extents = Vector2( 12.234, 13.1952 )
|
||||
extents = Vector2( 13.3341, 13.1952 )
|
||||
|
||||
[node name="Asteroid" type="KinematicBody2D"]
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ shapes/0/shape = SubResource( 1 )
|
|||
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 2
|
||||
collision/mask = 1
|
||||
collision/mask = 2
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
|
|
|
@ -35,5 +35,5 @@ func _draw():
|
|||
draw_rect(Rect2(s_x, s_y, 2, 2), Color(1, 1, 1))
|
||||
elif ent.type() == "PowerStation":
|
||||
draw_rect(Rect2(s_x, s_y, 4, 4), Color(0, 0, 1))
|
||||
elif ent.type() == "EnemyGrunt":
|
||||
elif ent.type() == "Enemy":
|
||||
draw_rect(Rect2(s_x, s_y, 2, 2), Color(1, 0, 0))
|
|
@ -1,5 +1,7 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
var ExplosionEffect = load("res://ExplosionEffect.tscn")
|
||||
|
||||
const km = preload("Kinematic.gd")
|
||||
|
||||
var grunt_max_speed = 256 # pixels per second
|
||||
|
@ -7,6 +9,8 @@ var grunt_arrive_radius = 64
|
|||
var grunt_arrive_speed = 1
|
||||
var grunt_rot_speed = deg2rad(22.5) # degrees per second
|
||||
|
||||
var health = 100
|
||||
|
||||
var cur_kinematic
|
||||
var steering
|
||||
var s_seek
|
||||
|
@ -15,7 +19,6 @@ var s_arrive
|
|||
func _ready():
|
||||
var t = get_tree().get_root().get_node("Game/MinimapControl").register_entity(self)
|
||||
set_fixed_process(true)
|
||||
set_process(true)
|
||||
|
||||
cur_kinematic = km.Kinematic.new(self, grunt_max_speed)
|
||||
steering = km.Steering.new()
|
||||
|
@ -27,8 +30,15 @@ func _ready():
|
|||
s_seek.set_target(player)
|
||||
s_arrive.set_target(player)
|
||||
|
||||
func on_explode():
|
||||
# create explosion effect
|
||||
var new_ee = ExplosionEffect.instance()
|
||||
get_tree().get_root().add_child(new_ee)
|
||||
new_ee.set_global_pos(get_global_pos())
|
||||
queue_free()
|
||||
|
||||
func do_damage(v):
|
||||
pass
|
||||
health -= v
|
||||
|
||||
func type():
|
||||
return "Enemy"
|
||||
|
@ -38,6 +48,9 @@ func _fixed_process(delta):
|
|||
s_arrive.get_steering(steering)
|
||||
cur_kinematic.update(steering, delta)
|
||||
|
||||
if health <= 0:
|
||||
on_explode()
|
||||
|
||||
func _process(delta):
|
||||
pass
|
||||
# rotate(grunt_rot_speed * delta)
|
||||
|
|
|
@ -11,13 +11,14 @@ extents = Vector2( 8.55915, 8.40247 )
|
|||
|
||||
[node name="EnemyGrunt" type="KinematicBody2D"]
|
||||
|
||||
transform/pos = Vector2( 0.12851, 0 )
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
input/pickable = false
|
||||
shapes/0/shape = SubResource( 1 )
|
||||
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/layers = 2
|
||||
collision/mask = 2
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
[ext_resource path="res://Player.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://raw/space.png" type="Texture" id=6]
|
||||
[ext_resource path="res://EnemyGrunt.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://BulletImpact.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://Missile.tscn" type="PackedScene" id=8]
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
|
||||
|
@ -72,8 +72,6 @@ region_rect = Rect2( 0, 0, 8192, 8192 )
|
|||
transform/pos = Vector2( 127.878, -20.3627 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="BulletImpact" parent="." instance=ExtResource( 8 )]
|
||||
|
||||
transform/pos = Vector2( 53.4955, -25.9372 )
|
||||
[node name="Missile" parent="." instance=ExtResource( 8 )]
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
const km = preload("Kinematic.gd")
|
||||
var MissileImpact = load("res://MissileImpact.tscn")
|
||||
|
||||
var missile_max_speed = 384 # pixels per second
|
||||
var missile_arrive_radius = 64
|
||||
var missile_arrive_speed = 1
|
||||
var missile_rot_speed = deg2rad(22.5) # degrees per second
|
||||
var missile_dmg = 100
|
||||
|
||||
var cur_kinematic
|
||||
var steering
|
||||
var s_seek
|
||||
var s_arrive
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
|
||||
cur_kinematic = km.Kinematic.new(self, missile_max_speed)
|
||||
steering = km.Steering.new()
|
||||
|
||||
s_seek = km.Seek.new(self)
|
||||
s_arrive = km.Arrive.new(self, missile_arrive_radius, missile_arrive_speed)
|
||||
|
||||
var player = get_tree().get_root().get_node("Game/Player")
|
||||
s_seek.set_target(player)
|
||||
s_arrive.set_target(player)
|
||||
|
||||
func on_impact(e):
|
||||
|
||||
# create bullet impact
|
||||
var new_mi = MissileImpact.instance()
|
||||
# e.add_child(new_mi)
|
||||
get_tree().get_root().add_child(new_mi)
|
||||
#new_bi.set_global_pos(get_collision_pos() + velocity/2)
|
||||
new_mi.set_scale(Vector2(1.5, 1.5)) # when missile, larger effect
|
||||
new_mi.set_global_pos(get_collision_pos())
|
||||
|
||||
# align along "hit normal, the lazy way"
|
||||
new_mi.set_global_rot((-get_collision_normal()).angle())
|
||||
|
||||
# new_bi.rotate(deg2rad(180))
|
||||
|
||||
# damage and free
|
||||
e.do_damage(missile_dmg)
|
||||
queue_free()
|
||||
|
||||
func _fixed_process(delta):
|
||||
s_seek.get_steering(steering)
|
||||
s_arrive.get_steering(steering)
|
||||
cur_kinematic.update(steering, delta)
|
||||
|
||||
if is_colliding():
|
||||
var e = get_collider()
|
||||
on_impact(e)
|
||||
|
||||
func type():
|
||||
return "Missile"
|
|
@ -0,0 +1,58 @@
|
|||
[gd_scene load_steps=4 format=1]
|
||||
|
||||
[ext_resource path="res://Missile.gd" type="Script" id=1]
|
||||
[ext_resource path="res://raw/missile_one.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
extents = Vector2( 0.531269, 3.07443 )
|
||||
|
||||
[node name="Missile" type="KinematicBody2D"]
|
||||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
input/pickable = false
|
||||
shapes/0/shape = SubResource( 1 )
|
||||
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 2
|
||||
collision/mask = 3
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Particles2D" type="Particles2D" parent="."]
|
||||
|
||||
transform/pos = Vector2( 0, 2.5151 )
|
||||
config/amount = 128
|
||||
config/lifetime = 2.0
|
||||
config/process_mode = 1
|
||||
config/local_space = false
|
||||
params/direction = 0.0
|
||||
params/spread = 12.0
|
||||
params/linear_velocity = 10.0
|
||||
params/spin_velocity = 0.0
|
||||
params/orbit_velocity = 0.0
|
||||
params/gravity_direction = 0.0
|
||||
params/gravity_strength = 9.8
|
||||
params/radial_accel = 0.0
|
||||
params/tangential_accel = 0.0
|
||||
params/damping = 0.0
|
||||
params/initial_angle = 0.0
|
||||
params/initial_size = 2.0
|
||||
params/final_size = 0.0
|
||||
params/hue_variation = 0.0
|
||||
params/anim_speed_scale = 1.0
|
||||
params/anim_initial_pos = 0.0
|
||||
color/color = Color( 1, 0.984375, 0, 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
shape = SubResource( 1 )
|
||||
trigger = false
|
||||
_update_shape_index = 0
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
extends Node2D
|
||||
|
||||
onready var sprite = get_node("Sprite")
|
||||
onready var ps = get_node("Particles2D")
|
||||
|
||||
var current_time = 0
|
||||
var frames_per_second = 0.05
|
||||
var total_time = 0
|
||||
var done = false
|
||||
|
||||
func _ready():
|
||||
set_process(true)
|
||||
total_time = sprite.get_hframes() * frames_per_second + 1.5 # 4 extra seconds for particle blast
|
||||
ps.set_process(false)
|
||||
|
||||
func _process(delta):
|
||||
|
||||
ps.set_process(true)
|
||||
|
||||
if not int(current_time / frames_per_second) >= sprite.get_hframes() - 1:
|
||||
sprite.set_frame(int(current_time / frames_per_second))
|
||||
elif not done:
|
||||
sprite.hide()
|
||||
done = true
|
||||
|
||||
current_time += delta
|
||||
|
||||
if current_time >= total_time:
|
||||
queue_free()
|
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=4 format=1]
|
||||
|
||||
[ext_resource path="res://MissileImpact.gd" type="Script" id=1]
|
||||
[ext_resource path="res://raw/bullet_impact.png" type="Texture" id=2]
|
||||
[ext_resource path="res://raw/exhaust.png" type="Texture" id=3]
|
||||
|
||||
[node name="MissileImpact" type="Node2D"]
|
||||
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
||||
texture = ExtResource( 2 )
|
||||
hframes = 5
|
||||
|
||||
[node name="Particles2D" type="Particles2D" parent="."]
|
||||
|
||||
transform/pos = Vector2( 0.130829, -3.26887 )
|
||||
transform/rot = -180.0
|
||||
config/amount = 32
|
||||
config/lifetime = 4.0
|
||||
config/time_scale = 2.0
|
||||
config/process_mode = 1
|
||||
config/explosiveness = 0.1
|
||||
config/texture = ExtResource( 3 )
|
||||
params/direction = 0.0
|
||||
params/spread = 60.0
|
||||
params/linear_velocity = 25.0
|
||||
params/spin_velocity = 0.0
|
||||
params/orbit_velocity = 0.0
|
||||
params/gravity_direction = 0.0
|
||||
params/gravity_strength = 9.8
|
||||
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 = 0.0
|
||||
params/hue_variation = 0.0
|
||||
params/anim_speed_scale = 1.0
|
||||
params/anim_initial_pos = 0.0
|
||||
randomness/orbit_velocity = 10.0
|
||||
randomness/gravity_direction = 1.0
|
||||
|
||||
|
|
@ -23,6 +23,12 @@ func _ready():
|
|||
left_particles.set_emitting(false)
|
||||
right_particles.set_emitting(false)
|
||||
|
||||
func type():
|
||||
return "Player"
|
||||
|
||||
func do_damage(v):
|
||||
pass
|
||||
|
||||
func turn_towards(delta, pos):
|
||||
|
||||
var target_dir = (pos - get_global_pos()).normalized()
|
||||
|
|
18
Player.tscn
18
Player.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=6 format=1]
|
||||
[gd_scene load_steps=7 format=1]
|
||||
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://img/player_ship.tex" type="Texture" id=2]
|
||||
|
@ -6,11 +6,19 @@
|
|||
[ext_resource path="res://raw/exhaust.png" type="Texture" id=4]
|
||||
[ext_resource path="res://ThrusterScript.gd" type="Script" id=5]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
extents = Vector2( 14.9829, 14.1367 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
input/pickable = false
|
||||
collision/layers = 3
|
||||
shapes/0/shape = SubResource( 1 )
|
||||
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 1
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
@ -176,4 +184,10 @@ drag_margin/top = 0.2
|
|||
drag_margin/right = 0.2
|
||||
drag_margin/bottom = 0.2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
shape = SubResource( 1 )
|
||||
trigger = false
|
||||
_update_shape_index = 0
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ input/pickable = false
|
|||
shapes/0/shape = SubResource( 1 )
|
||||
shapes/0/transform = Matrix32( 2, 0, 0, 2, 0, 0 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/layers = 2
|
||||
collision/mask = 2
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
filter=false
|
||||
gen_mipmaps=false
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 101 B |
|
@ -0,0 +1,2 @@
|
|||
filter=false
|
||||
gen_mipmaps=false
|
Loading…
Reference in New Issue