Compare commits
No commits in common. "6431259f7f8b1498208a9ed66371b2a0ea8b811b" and "cc8bdb2bfe2c87b73a79957304963d9004fd15a0" have entirely different histories.
6431259f7f
...
cc8bdb2bfe
3 changed files with 4 additions and 38 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 760 B After Width: | Height: | Size: 1.7 KiB |
|
|
@ -76,14 +76,8 @@ animations = [{
|
|||
"speed": 15.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qlg0r"]
|
||||
size = Vector2(24, 10)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tuyoq"]
|
||||
size = Vector2(24, 30)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dqkch"]
|
||||
size = Vector2(6, 5.75)
|
||||
size = Vector2(10, 11)
|
||||
|
||||
[node name="Player" type="Area2D" unique_id=652131079]
|
||||
script = ExtResource("1_g2els")
|
||||
|
|
@ -109,22 +103,9 @@ sprite_frames = SubResource("SpriteFrames_3v2ag")
|
|||
animation = &"stock"
|
||||
autoplay = "stock"
|
||||
|
||||
[node name="MuzzleBox" type="CollisionShape2D" parent="." unique_id=1042837273]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -17)
|
||||
shape = SubResource("RectangleShape2D_qlg0r")
|
||||
disabled = true
|
||||
debug_color = Color(1, 0.5058824, 0.21960784, 0.41960785)
|
||||
|
||||
[node name="HelpBox" type="CollisionShape2D" parent="." unique_id=938667427]
|
||||
position = Vector2(0, 3)
|
||||
shape = SubResource("RectangleShape2D_tuyoq")
|
||||
debug_color = Color(0, 1, 0, 0.41960785)
|
||||
|
||||
[node name="HitBox" type="CollisionShape2D" parent="." unique_id=485826453]
|
||||
position = Vector2(0, 2)
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=485826453]
|
||||
position = Vector2(0, -3.5)
|
||||
shape = SubResource("RectangleShape2D_dqkch")
|
||||
debug_color = Color(0.9843137, 0, 0, 0.80784315)
|
||||
|
||||
[node name="WeaponCooldown" type="Timer" parent="." unique_id=269678170]
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ var weapon_timer: float = 0.0
|
|||
var weapon_spacing: float = 0.1
|
||||
|
||||
@onready var screensize = get_viewport_rect().size
|
||||
@onready var muzzle_damage = %MuzzleBox
|
||||
|
||||
func _process(delta):
|
||||
var input = Input.get_vector("left", "right", "up","down")
|
||||
|
|
@ -32,32 +31,24 @@ func _process(delta):
|
|||
|
||||
# Sprite feedback based one player input
|
||||
if input.x > 0:
|
||||
%Ship/Thrusters.position.x = $Ship.position.x+1
|
||||
%Ship.frame = 2
|
||||
%Ship/Thrusters.flip_h = true
|
||||
%Ship/Thrusters.animation = "banked"
|
||||
elif input.x < 0:
|
||||
%Ship/Thrusters.position.x = $Ship.position.x-1
|
||||
%Ship.frame = 1
|
||||
%Ship/Thrusters.flip_h = false
|
||||
%Ship/Thrusters.animation = "banked"
|
||||
else:
|
||||
%Ship.frame = 0
|
||||
%Ship/Thrusters.position.x = $Ship.position.x
|
||||
%Ship/Thrusters.flip_h = false
|
||||
%Ship/Thrusters.animation = "fwd"
|
||||
|
||||
# Get previous positon for equidistant bullet calculation
|
||||
previous_position = position
|
||||
|
||||
# Move the ship based on input within the screen bounds
|
||||
position += input * speed * delta
|
||||
position = position.clamp(Vector2(12,12), screensize - Vector2(12,12))
|
||||
|
||||
# Enable muzzle damage hitbox upon firing
|
||||
if Input.is_action_pressed("shoot"):
|
||||
is_shooting = true
|
||||
muzzle_damage.set("disabled", false)
|
||||
|
||||
else:
|
||||
is_shooting = false
|
||||
|
|
@ -67,14 +58,12 @@ func _process(delta):
|
|||
%MuzzleFlash.show()
|
||||
%Ship/MuzzleFlash.animation = "stock"
|
||||
|
||||
# Adjust bullet spacing before firing
|
||||
if travel > weapon_spacing:
|
||||
shoot()
|
||||
travel -= weapon_spacing
|
||||
|
||||
if is_shooting == false:
|
||||
%MuzzleFlash.hide()
|
||||
muzzle_damage.set("disabled", true)
|
||||
|
||||
func shield_set(_value: int):
|
||||
return
|
||||
|
|
@ -91,13 +80,9 @@ func shoot():
|
|||
var bullet = weapon_current.instantiate()
|
||||
get_tree().root.add_child(bullet)
|
||||
bullet.position = position + Vector2(0,-23)
|
||||
|
||||
# Get weapon speed and spacing for equidistant calculations
|
||||
weapon_rate = bullet.shot_data.rate
|
||||
weapon_spacing = bullet.shot_data.spacing
|
||||
bullet_speed = abs(bullet.shot_data.speed)
|
||||
|
||||
# Print which weapon is firing
|
||||
prints(bullet.shot_data.shot_name, "weapon fired")
|
||||
prints(bullet.shot_data.shot_name, "weapon fired") #Print which weapon is firing
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue