TODO bat sonic wave

main
Just Dzhi 2023-10-02 00:09:01 +04:00
parent ed6e3db4b8
commit f314860b17
7 changed files with 85 additions and 3 deletions

View File

@ -19,6 +19,7 @@ script = ExtResource( 2 )
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 2
playing = true playing = true
centered = false centered = false
@ -31,3 +32,8 @@ shape = SubResource( 1 )
[node name="SameSpeciesCollider" type="CollisionShape2D" parent="."] [node name="SameSpeciesCollider" type="CollisionShape2D" parent="."]
position = Vector2( 8.5, 10 ) position = Vector2( 8.5, 10 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="Timer" type="Timer" parent="."]
autostart = true
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

View File

@ -3,6 +3,9 @@ extends EnemyClass
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
var speed = 64 var speed = 64
onready var sonic_wave_preload = preload("res://src/models/sonic_wave/Sonic_Wave.tscn")
var sonic_wave
func _ready(): func _ready():
hp = 15 hp = 15
@ -27,3 +30,14 @@ func _physics_process(_delta):
velocity *= speed * speed_multiplier velocity *= speed * speed_multiplier
velocity = move_and_slide(velocity) velocity = move_and_slide(velocity)
func _shoot():
sonic_wave = sonic_wave_preload.instance()
get_parent().add_child(sonic_wave)
sonic_wave.global_position.x = self.global_position.x + 8
sonic_wave.global_position.y = self.global_position.y + 8
func _on_Timer_timeout():
_shoot()

View File

@ -5,10 +5,10 @@
[ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3] [ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 4 ) extents = Vector2( 3.5, 3.5 )
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 7, 11 ) extents = Vector2( 3.5, 9 )
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=4]
resource_name = "RESET" resource_name = "RESET"
@ -48,7 +48,7 @@ tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 0.9 ), "times": PoolRealArray( 0, 2 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 1, "update": 1,
"values": [ true, false ] "values": [ true, false ]

View File

@ -0,0 +1,9 @@
extends KinematicBody2D
var velocity = Vector2.ZERO
var speed = 120
onready var player = $"../../Player"
func _physics_process(delta):
self.global_position = self.global_position.move_toward(player.global_position, delta * speed)
$Sprite.look_at(player.global_position)

View File

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/models/sonic_wave/sonic_wave.png" type="Texture" id=1]
[ext_resource path="res://src/models/sonic_wave/Sonic_Wave.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 3, 4.25 )
[node name="Sonic_Wave" type="KinematicBody2D"]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 1 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sonic_wave.png-1cdfaa07cb82928a187ef5a3d8e5dab8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/sonic_wave/sonic_wave.png"
dest_files=[ "res://.import/sonic_wave.png-1cdfaa07cb82928a187ef5a3d8e5dab8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0