mirror of https://github.com/profan/ld-39-jam.git
bullet layer and such, dont collide bullets with other bullets
This commit is contained in:
parent
53432b8552
commit
efbcd5cf22
|
@ -15,7 +15,7 @@ input/pickable = false
|
|||
shapes/0/shape = SubResource( 1 )
|
||||
shapes/0/transform = Matrix32( 1, 0, 0, 1, -0.17482, 1.87222 )
|
||||
shapes/0/trigger = false
|
||||
collision/layers = 1
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
|
|
@ -10,8 +10,8 @@ func _ready():
|
|||
|
||||
func fire(delta, vel, dir, speed):
|
||||
velocity = (vel.length() * dir + (dir * speed * delta))
|
||||
sprite.rotate(dir.angle())
|
||||
|
||||
sprite.set_rot(dir.angle())
|
||||
|
||||
func type():
|
||||
return "Bullet"
|
||||
|
||||
|
|
|
@ -11,11 +11,12 @@ extents = Vector2( 0.99762, 3.98857 )
|
|||
[node name="Bullet" type="KinematicBody2D"]
|
||||
|
||||
transform/rot = 180.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 = 1
|
||||
collision/layers = 2
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
input/pickable = false
|
||||
collision/layers = 1
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
|
5
Gun.gd
5
Gun.gd
|
@ -4,7 +4,8 @@ var Bullet = load("res://Bullet.tscn")
|
|||
|
||||
var gun_cooldown = 0
|
||||
var gun_delay = 0.1125
|
||||
var gun_spread_max = deg2rad(1) # degrees max
|
||||
var gun_spread_max = deg2rad(4) # degrees max
|
||||
var gun_bullet_speed = 384
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
|
@ -19,5 +20,5 @@ func fire(delta, vel, dir):
|
|||
new_bullet.set_pos(gun_pos + vel)
|
||||
get_tree().get_root().add_child(new_bullet)
|
||||
var rot = rand_range(-gun_spread_max, gun_spread_max)
|
||||
new_bullet.fire(delta, vel, dir.rotated(rot), 512)
|
||||
new_bullet.fire(delta, vel, dir.rotated(rot), gun_bullet_speed)
|
||||
gun_cooldown += gun_delay
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
transform/scale = Vector2( 2, 2 )
|
||||
input/pickable = false
|
||||
collision/layers = 1
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[node name="PowerStation" type="KinematicBody2D"]
|
||||
|
||||
input/pickable = false
|
||||
collision/layers = 1
|
||||
collision/layers = 3
|
||||
collision/mask = 1
|
||||
collision/margin = 0.08
|
||||
script/script = ExtResource( 1 )
|
||||
|
|
BIN
raw/simple_bullet.ase (Stored with Git LFS)
BIN
raw/simple_bullet.ase (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 138 B |
Loading…
Reference in New Issue