mirror of https://github.com/profan/ld-39-jam.git
more collidey stuff
This commit is contained in:
parent
2db217191d
commit
39feb442b7
|
@ -25,7 +25,8 @@ func on_impact(e):
|
|||
var new_bi = BulletImpact.instance()
|
||||
e.add_child(new_bi)
|
||||
# get_tree().get_root().add_child(new_bi)
|
||||
new_bi.set_global_pos(get_collision_pos() + velocity/2)
|
||||
#new_bi.set_global_pos(get_collision_pos() + velocity/2)
|
||||
new_bi.set_global_pos(get_collision_pos())
|
||||
|
||||
# align along "hit normal, the lazy way"
|
||||
new_bi.set_global_rot((-get_collision_normal()).angle())
|
||||
|
@ -43,7 +44,8 @@ func _fixed_process(delta):
|
|||
|
||||
if is_colliding():
|
||||
var e = get_collider()
|
||||
if e.type() == "Asteroid":
|
||||
var e_t = e.type()
|
||||
if e_t == "Asteroid" or e_t == "Enemy" or e_t == "PowerStation":
|
||||
on_impact(e)
|
||||
|
||||
if lifetime <= 0:
|
||||
|
|
|
@ -26,9 +26,12 @@ func _ready():
|
|||
var player = get_tree().get_root().get_node("Game/Player")
|
||||
s_seek.set_target(player)
|
||||
s_arrive.set_target(player)
|
||||
|
||||
func do_damage(v):
|
||||
pass
|
||||
|
||||
func type():
|
||||
return "EnemyGrunt"
|
||||
return "Enemy"
|
||||
|
||||
func _fixed_process(delta):
|
||||
s_seek.get_steering(steering)
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
[gd_scene load_steps=4 format=1]
|
||||
[gd_scene load_steps=5 format=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/exhaust.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
extents = Vector2( 8.55915, 8.40247 )
|
||||
|
||||
[node name="EnemyGrunt" 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 = 3
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
shape = SubResource( 1 )
|
||||
trigger = false
|
||||
_update_shape_index = 0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
||||
texture = ExtResource( 2 )
|
||||
|
|
|
@ -8,6 +8,9 @@ func _ready():
|
|||
var n = r.get_node("Game/MinimapControl")
|
||||
n.register_entity(self)
|
||||
set_process(true)
|
||||
|
||||
func do_damage(v):
|
||||
pass
|
||||
|
||||
func type():
|
||||
return "PowerStation"
|
||||
|
|
|
@ -1,16 +1,31 @@
|
|||
[gd_scene load_steps=3 format=1]
|
||||
[gd_scene load_steps=4 format=1]
|
||||
|
||||
[ext_resource path="res://PowerStation.gd" type="Script" id=1]
|
||||
[ext_resource path="res://raw/power_station.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
custom_solver_bias = 0.0
|
||||
extents = Vector2( 31.9978, 32.0533 )
|
||||
|
||||
[node name="PowerStation" type="KinematicBody2D"]
|
||||
|
||||
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/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
shape = SubResource( 1 )
|
||||
trigger = false
|
||||
_update_shape_index = 0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
|
|
Loading…
Reference in New Issue