mirror of https://github.com/profan/ld-39-jam.git
position including velocity
This commit is contained in:
parent
d9ef9dde4f
commit
e29ab412b5
25
Game.tscn
25
Game.tscn
|
@ -72,6 +72,31 @@ region_rect = Rect2( 0, 0, 8192, 8192 )
|
|||
transform/pos = Vector2( 127.878, -20.3627 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="EnemyGrunt1" parent="." instance=ExtResource( 7 )]
|
||||
|
||||
transform/pos = Vector2( -154.501, -21.5904 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="EnemyGrunt2" parent="." instance=ExtResource( 7 )]
|
||||
|
||||
transform/pos = Vector2( 361.148, -21.5904 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="EnemyGrunt3" parent="." instance=ExtResource( 7 )]
|
||||
|
||||
transform/pos = Vector2( 583.368, -24.0459 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="EnemyGrunt4" parent="." instance=ExtResource( 7 )]
|
||||
|
||||
transform/pos = Vector2( 878.024, -24.0459 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="EnemyGrunt5" parent="." instance=ExtResource( 7 )]
|
||||
|
||||
transform/pos = Vector2( -374.266, -24.0459 )
|
||||
transform/scale = Vector2( 1.5, 1.5 )
|
||||
|
||||
[node name="Missile" parent="." instance=ExtResource( 8 )]
|
||||
|
||||
transform/pos = Vector2( -494.716, 83.0652 )
|
||||
|
|
|
@ -15,7 +15,7 @@ class Kinematic:
|
|||
max_speed = m
|
||||
|
||||
func get_position():
|
||||
return owner.get_global_pos()
|
||||
return owner.get_kinematic_position()
|
||||
|
||||
func get_orientation():
|
||||
return velocity.normalized()
|
||||
|
@ -50,7 +50,7 @@ class Seek:
|
|||
var tr = target.get_ref()
|
||||
if tr:
|
||||
# update velocity
|
||||
s.velocity = tr.get_global_pos() - owner.get_global_pos()
|
||||
s.velocity = tr.get_kinematic_position() - owner.get_global_pos()
|
||||
# update orientation
|
||||
#if velocity.length() > 0:
|
||||
# rotation = clamp(velocity.normalized().angle(), -max_rot_speed, max_rot_speed)
|
||||
|
|
Loading…
Reference in New Issue