diff --git a/graphics/ship.png b/graphics/ship.png index a260f6c..effbe4e 100644 Binary files a/graphics/ship.png and b/graphics/ship.png differ diff --git a/scenes/player.tscn b/scenes/player.tscn index 7233823..177e4e7 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -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] diff --git a/scripts/player.gd b/scripts/player.gd index 9d12920..669b58e 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -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