Compare commits
No commits in common. "d4973ef920bea7f135ba77bd37020df7b59744f5" and "a490eb3d05e97ca629874ecd9b45e7abacd8a0ff" have entirely different histories.
d4973ef920
...
a490eb3d05
|
@ -1,7 +1,5 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
var explosion_preload = preload("res://src/models/explosion/Explosion.tscn")
|
||||
var explode = false
|
||||
var velocity = Vector2.ZERO
|
||||
var speed = 128
|
||||
var poison_damage = 0
|
||||
|
@ -14,7 +12,6 @@ var prev_target
|
|||
var target
|
||||
var explosive_damage = 0
|
||||
var speed_modifier = 1
|
||||
var target_center
|
||||
|
||||
func choose_target():
|
||||
target = null
|
||||
|
@ -23,7 +20,6 @@ func choose_target():
|
|||
var enemies = get_tree().get_nodes_in_group("enemy")
|
||||
for enemy in enemies:
|
||||
enemy.material = null
|
||||
if enemy.global_position.y < 20 or enemy.global_position.x < 20 or enemy.global_position.x > 300 or enemy.global_position.y > 120: continue
|
||||
enemy_dist = global_position.distance_to(enemy.global_position)
|
||||
if enemy_dist < least_dist and enemy != prev_target:
|
||||
least_dist = enemy_dist
|
||||
|
@ -33,7 +29,7 @@ func _physics_process(delta):
|
|||
if target != null and is_instance_valid(target) and not target.dead:
|
||||
var target_texture = target.get_node("Sprite").frames.get_frame("idle", 0)
|
||||
var target_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
|
||||
target_center = target.global_position + (target_sprite_size / 2)
|
||||
var target_center = target.global_position + (target_sprite_size / 2)
|
||||
if target.is_in_group("rat"):
|
||||
target_center = target.global_position + Vector2(0, 2)
|
||||
self.global_position = self.global_position.move_toward(target_center, delta * speed * speed_modifier)
|
||||
|
@ -49,11 +45,6 @@ func area_entered(area):
|
|||
parent.frozen_timer = 0
|
||||
parent.poison_damage = poison_damage
|
||||
parent.poisoned_timer = 0
|
||||
if not explode and explosive_damage != 0:
|
||||
explode = true
|
||||
var explosion = explosion_preload.instance()
|
||||
explosion.global_position = target_center + Vector2(0, -16)
|
||||
get_parent().add_child(explosion)
|
||||
if bounced >= ricochet_count:
|
||||
call_deferred("free")
|
||||
choose_target()
|
||||
|
|
|
@ -22,7 +22,7 @@ script = ExtResource( 2 )
|
|||
use_parent_material = true
|
||||
frames = ExtResource( 1 )
|
||||
animation = "idle"
|
||||
frame = 2
|
||||
frame = 3
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
|
|
|
@ -11,13 +11,9 @@ var shot = false
|
|||
var sonic_wave
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
self.global_position.x = ([-1, 1][randi()%2] * 320) + randi()%40 + 20
|
||||
self.global_position.y = ([-1, 1][randi()%2] * 180) + randi()%40 + 20
|
||||
hp = 7
|
||||
|
||||
func _physics_process(delta):
|
||||
if not (global_position.y < 20 or global_position.x < 20 or global_position.x > 300 or global_position.y > 120):
|
||||
if Global.playing:
|
||||
if not shooting:
|
||||
shooting_timer += delta
|
||||
|
|
|
@ -7,8 +7,6 @@ var dash_timer = .0
|
|||
var dashing = false
|
||||
|
||||
func _ready():
|
||||
self.global_position.x = ([-1, 1][randi()%2] * 320) + randi()%120 + 50
|
||||
self.global_position.y = ([-1, 1][randi()%2] * 180) + randi()%40 + 20
|
||||
hp = 8
|
||||
|
||||
func _physics_process(delta):
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://src/models/explosion/explosion.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/models/explosion/sprites/4.png" type="Texture" id=2]
|
||||
[ext_resource path="res://src/models/explosion/sprites/3.png" type="Texture" id=3]
|
||||
[ext_resource path="res://src/models/explosion/sprites/2.png" type="Texture" id=4]
|
||||
[ext_resource path="res://src/models/explosion/sprites/1.png" type="Texture" id=5]
|
||||
[ext_resource path="res://src/models/explosion/sprites/0.png" type="Texture" id=6]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 16.0
|
||||
height = 10.0
|
||||
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 6 ), ExtResource( 5 ), ExtResource( 4 ), ExtResource( 3 ), ExtResource( 2 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 10.0
|
||||
} ]
|
||||
|
||||
[node name="Explosion" type="StaticBody2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 2 )
|
||||
playing = true
|
||||
|
||||
[connection signal="animation_finished" from="AnimatedSprite" to="." method="animation_finished"]
|
|
@ -1,13 +0,0 @@
|
|||
extends StaticBody2D
|
||||
|
||||
var damage = 10
|
||||
|
||||
func _ready():
|
||||
var areas = $Area2D.get_overlapping_areas()
|
||||
for area in areas:
|
||||
var parent = area.get_parent()
|
||||
if parent.is_in_group("enemy"):
|
||||
parent.deal_damage(damage)
|
||||
|
||||
func animation_finished():
|
||||
call_deferred("free")
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/0.png-d73025098797765d024006d9d769fa4e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/explosion/sprites/0.png"
|
||||
dest_files=[ "res://.import/0.png-d73025098797765d024006d9d769fa4e.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
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/1.png-6c970d4aadcef0ae8ef956266e565aed.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/explosion/sprites/1.png"
|
||||
dest_files=[ "res://.import/1.png-6c970d4aadcef0ae8ef956266e565aed.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
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/2.png-41242ab1d12bd2382159018fca8a7c9f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/explosion/sprites/2.png"
|
||||
dest_files=[ "res://.import/2.png-41242ab1d12bd2382159018fca8a7c9f.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
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/3.png-5688b816e8f3e17c802b934c1cd11fac.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/explosion/sprites/3.png"
|
||||
dest_files=[ "res://.import/3.png-5688b816e8f3e17c802b934c1cd11fac.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
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1,35 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/4.png-5590e0566be025759130a2112c402cbe.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/explosion/sprites/4.png"
|
||||
dest_files=[ "res://.import/4.png-5590e0566be025759130a2112c402cbe.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
|
|
@ -54,7 +54,6 @@ func choose_target():
|
|||
var enemies = get_tree().get_nodes_in_group("enemy")
|
||||
for enemy in enemies:
|
||||
enemy.material = null
|
||||
if enemy.global_position.y < 20 or enemy.global_position.x < 20 or enemy.global_position.x > 300 or enemy.global_position.y > 120: continue
|
||||
enemy_dist = global_position.distance_to(enemy.global_position)
|
||||
if enemy_dist < least_dist:
|
||||
least_dist = enemy_dist
|
||||
|
|
Loading…
Reference in New Issue