surround sound
This commit is contained in:
parent
43323bb086
commit
7930630475
26 changed files with 354 additions and 20 deletions
93
sprites/common/bullet/sword.gd
Normal file
93
sprites/common/bullet/sword.gd
Normal file
|
@ -0,0 +1,93 @@
|
|||
extends Area2D
|
||||
var velocity: Vector2 = Vector2()
|
||||
var direction
|
||||
var speciality
|
||||
var btype
|
||||
var attack
|
||||
var crit
|
||||
var angular_speed = 5*PI
|
||||
var origangle
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if direction == null:
|
||||
origangle = velocity.angle()
|
||||
else:
|
||||
origangle = direction.angle()
|
||||
rotation = origangle
|
||||
if is_in_group("players"):
|
||||
speciality = Global.pcspecialities[Global.dparty[Global.dcpchar][0]]
|
||||
add_to_group(btype)
|
||||
#pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _physics_process(delta):
|
||||
rotation -= angular_speed * delta
|
||||
print(rotation)
|
||||
if rotation+deg_to_rad(180) < origangle:
|
||||
queue_free()
|
||||
|
||||
func _on_body_entered(body):
|
||||
if !body.is_in_group(btype) && Global.live == 1:
|
||||
if body.is_in_group("players") && Global.dificulty != 1:
|
||||
if body.weakness == speciality:
|
||||
print("weakness")
|
||||
#Input.start_joy_vibration(0,0,1,3)
|
||||
if Global.debug:
|
||||
if Global.dstats[Global.dparty[Global.dcpchar][0]][0] > (attack * crit):
|
||||
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack * crit
|
||||
else:
|
||||
Global.dstats[Global.dparty[Global.dcpchar][0]][0] = 0
|
||||
else:
|
||||
if Global.cstats[Global.party[Global.cpchar][0]][0] > (attack * crit):
|
||||
Global.cstats[Global.party[Global.cpchar][0]][0] -= attack * crit
|
||||
else:
|
||||
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
|
||||
else:
|
||||
#Input.start_joy_vibration(0,1,0,2)
|
||||
if Global.debug:
|
||||
if Global.dstats[Global.dparty[Global.dcpchar][0]][0] > attack:
|
||||
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack
|
||||
else:
|
||||
Global.dstats[Global.dparty[Global.dcpchar][0]][0] = 0
|
||||
else:
|
||||
if Global.cstats[Global.party[Global.cpchar][0]][0] > attack:
|
||||
Global.cstats[Global.party[Global.cpchar][0]][0] -= attack
|
||||
else:
|
||||
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
|
||||
elif body.is_in_group("boss") && Global.dificulty != 1:
|
||||
if body.weakness == speciality:
|
||||
print("weakness")
|
||||
if Global.cboss[1] > (attack * crit):
|
||||
Global.cboss[1] -= attack * crit
|
||||
else:
|
||||
Global.cboss[1] = 0
|
||||
else:
|
||||
if Global.cboss[1] > (attack):
|
||||
Global.cboss[1] -= attack
|
||||
else:
|
||||
Global.cboss[1] = 0
|
||||
elif body.is_in_group("enemies") && Global.dificulty != 1:
|
||||
if body.weakness == speciality:
|
||||
print("weakness")
|
||||
#if body.is_in_group("players"):
|
||||
# Global.live = 2
|
||||
#elif body.is_in_group("enemies"):
|
||||
# Global.live = 3
|
||||
#elif body.is_in_group("boss"):
|
||||
# Global.live = 3
|
||||
# queue_free()
|
||||
|
||||
|
||||
|
||||
func _on_area_entered(area):
|
||||
if !area.is_in_group(btype):
|
||||
queue_free()
|
||||
#pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
queue_free()
|
BIN
sprites/common/bullet/sword.png
Normal file
BIN
sprites/common/bullet/sword.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
34
sprites/common/bullet/sword.png.import
Normal file
34
sprites/common/bullet/sword.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ca17ddf0kokpv"
|
||||
path="res://.godot/imported/sword.png-b74bc94f384d21eae7c7d6c961dab98b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/common/bullet/sword.png"
|
||||
dest_files=["res://.godot/imported/sword.png-b74bc94f384d21eae7c7d6c961dab98b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
28
sprites/common/bullet/sword.tscn
Normal file
28
sprites/common/bullet/sword.tscn
Normal file
|
@ -0,0 +1,28 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bex0xeqbq5uci"]
|
||||
|
||||
[ext_resource type="Script" path="res://sprites/common/bullet/sword.gd" id="1_7tric"]
|
||||
[ext_resource type="Texture2D" uid="uid://ca17ddf0kokpv" path="res://sprites/common/bullet/sword.png" id="2_pgywo"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_g125y"]
|
||||
size = Vector2(128, 28)
|
||||
|
||||
[node name="Sword" type="Area2D"]
|
||||
script = ExtResource("1_7tric")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, 64)
|
||||
rotation = 1.5708
|
||||
texture = ExtResource("2_pgywo")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 64)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("RectangleShape2D_g125y")
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
position = Vector2(0, 64)
|
||||
rotation = 1.5708
|
||||
scale = Vector2(6.4, 1.4)
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
Loading…
Add table
Add a link
Reference in a new issue