Added minelayer textures
This commit is contained in:
@@ -10,6 +10,7 @@ enum Belonging { PLAYER, ENEMY }
|
||||
|
||||
@export var Projectile : PackedScene
|
||||
@export var reloaders : Array[AbstractReloader]
|
||||
@export var projectile_positions : Array[Vector2]
|
||||
|
||||
|
||||
const PREFIXES := {
|
||||
@@ -22,6 +23,7 @@ const IDLE_POSTFIX = "idle"
|
||||
|
||||
|
||||
var _belonging: Belonging
|
||||
var _current_projectile_position := 0
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
@@ -38,6 +40,13 @@ func shoot(ship_velocity: Vector2) -> bool:
|
||||
|
||||
for i in range(bullet_per_shot):
|
||||
var projectile := _create_projectile(ship_velocity)
|
||||
|
||||
if projectile_positions.size() > 0:
|
||||
projectile.global_position = global_position + projectile_positions[_current_projectile_position]
|
||||
_current_projectile_position += 1
|
||||
if _current_projectile_position >= projectile_positions.size():
|
||||
_current_projectile_position = 0
|
||||
|
||||
get_tree().current_scene.add_child(projectile)
|
||||
|
||||
for reloader in reloaders:
|
||||
@@ -46,7 +55,7 @@ func shoot(ship_velocity: Vector2) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func _create_projectile(ship_velocity: Vector2) -> Node:
|
||||
func _create_projectile(ship_velocity: Vector2) -> AbstractProjectile:
|
||||
var projectile : AbstractProjectile = Projectile.instantiate()
|
||||
projectile.global_position = global_position
|
||||
projectile.ship_velocity = ship_velocity
|
||||
|
||||
@@ -1 +1,22 @@
|
||||
extends AbstractWeapon
|
||||
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
||||
|
||||
|
||||
func set_belonging(belonging: Belonging) -> void:
|
||||
super.set_belonging(belonging)
|
||||
|
||||
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
|
||||
|
||||
|
||||
func shoot(ship_velocity: Vector2) -> bool:
|
||||
var is_shot := super.shoot(ship_velocity)
|
||||
if is_shot:
|
||||
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
|
||||
|
||||
return is_shot
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
|
||||
|
||||
@@ -1,18 +1,123 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://j3yht6q4ru4e"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://j3yht6q4ru4e"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_12l3k"]
|
||||
[ext_resource type="PackedScene" uid="uid://4mkklqt1g14f" path="res://game/entities/weapons/minelayer/minelayer_projectile.tscn" id="2_7y446"]
|
||||
[ext_resource type="Script" uid="uid://c3ckkpjaef5jn" path="res://game/entities/weapons/minelayer/minelayer_weapon.gd" id="2_mmhtn"]
|
||||
[ext_resource type="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_uotj8"]
|
||||
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_fbmxv"]
|
||||
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_ais8e"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uotj8"]
|
||||
script = ExtResource("4_fbmxv")
|
||||
firerate = 40
|
||||
metadata/_custom_type_script = "uid://b255rb32vc6co"
|
||||
|
||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_dra6h"]
|
||||
size = Vector2(10, 7)
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ais8e"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(0, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a7h2a"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(32, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5u2pu"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(64, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iwxdg"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(96, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oyt37"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(128, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fvahc"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(160, 128, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6718t"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(0, 112, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwpdh"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(32, 112, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m6clj"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(64, 112, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tqqar"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(96, 112, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mq3tp"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(128, 112, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8yhut"]
|
||||
atlas = ExtResource("6_ais8e")
|
||||
region = Rect2(160, 112, 32, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_wwpdh"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ais8e")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"enemy_idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a7h2a")
|
||||
}, {
|
||||
"duration": 10.0,
|
||||
"texture": SubResource("AtlasTexture_5u2pu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_iwxdg")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_oyt37")
|
||||
}, {
|
||||
"duration": 2.0,
|
||||
"texture": SubResource("AtlasTexture_fvahc")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"enemy_shot",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6718t")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"player_idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wwpdh")
|
||||
}, {
|
||||
"duration": 10.0,
|
||||
"texture": SubResource("AtlasTexture_m6clj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tqqar")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mq3tp")
|
||||
}, {
|
||||
"duration": 2.0,
|
||||
"texture": SubResource("AtlasTexture_8yhut")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"player_shot",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[node name="MinelayerWeapon" instance=ExtResource("1_12l3k")]
|
||||
script = ExtResource("2_mmhtn")
|
||||
@@ -20,5 +125,8 @@ sector_angle = 10
|
||||
Projectile = ExtResource("2_7y446")
|
||||
reloaders = Array[ExtResource("3_uotj8")]([SubResource("Resource_uotj8")])
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
|
||||
texture = SubResource("PlaceholderTexture2D_dra6h")
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
|
||||
sprite_frames = SubResource("SpriteFrames_wwpdh")
|
||||
animation = &"player_shot"
|
||||
|
||||
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
||||
|
||||
@@ -160,9 +160,10 @@ lifetime_randomness = 0.5
|
||||
particle_flag_disable_z = true
|
||||
angle_min = 1.0728835e-05
|
||||
angle_max = 360.00003
|
||||
inherit_velocity_ratio = 0.5
|
||||
spread = 180.0
|
||||
initial_velocity_min = 5.0
|
||||
initial_velocity_max = 5.0
|
||||
initial_velocity_min = 15.0
|
||||
initial_velocity_max = 25.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
|
||||
[node name="TeslaWeapon" instance=ExtResource("1_rpud7")]
|
||||
@@ -181,6 +182,6 @@ animation = &"player_idle"
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="." index="2"]
|
||||
amount = 16
|
||||
texture = SubResource("GradientTexture1D_ucdpq")
|
||||
lifetime = 2.0
|
||||
lifetime = 0.09999999999999999
|
||||
fixed_fps = 10
|
||||
process_material = SubResource("ParticleProcessMaterial_ifsj2")
|
||||
|
||||
@@ -45,8 +45,7 @@ func can_shoot() -> bool:
|
||||
|
||||
|
||||
func shoot() -> void:
|
||||
var random_heat := randf_range(-_cool_per_sec_tenth, _cool_per_sec_tenth)
|
||||
_heat += heat_per_shot + random_heat
|
||||
_heat += heat_per_shot
|
||||
|
||||
|
||||
func reload() -> void:
|
||||
|
||||
@@ -27,8 +27,7 @@ func can_shoot() -> bool:
|
||||
|
||||
|
||||
func shoot() -> void:
|
||||
var random_delay := randf_range(-_delay_tenth, _delay_tenth)
|
||||
_cooldown = _delay + random_delay
|
||||
_cooldown = _delay
|
||||
|
||||
|
||||
func reload() -> void:
|
||||
|
||||
@@ -45,8 +45,7 @@ func shoot() -> void:
|
||||
|
||||
func reload() -> void:
|
||||
if _countdown > 0 or _bullets_in_magazine == magazine_size: return
|
||||
var random_delay := randf_range(-_reload_time_tenth, _reload_time_tenth)
|
||||
_countdown = reload_time + random_delay
|
||||
_countdown = reload_time
|
||||
|
||||
|
||||
func get_process_percent() -> int:
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ config_version=5
|
||||
|
||||
config/name="Scrap Frontier"
|
||||
config/description="Scroll Shooter"
|
||||
config/tags=PackedStringArray("2d")
|
||||
config/tags=PackedStringArray("2d", "scrollshooter")
|
||||
run/main_scene="uid://2oavbr7oaihg"
|
||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
Reference in New Issue
Block a user