bidirectional damage

This commit is contained in:
Page Asgardius 2024-06-17 14:08:25 -07:00
parent 0f970b3d7a
commit 7eb094280f
12 changed files with 74 additions and 20 deletions

View file

@ -26,6 +26,7 @@ func _physics_process(delta):
print("move down")
func _input(event):
if Global.cdialog.size() == 0:
if Global.cdialog.size() != 0 && Global.live == 1:
get_tree().root.remove_child(talk)
Global.cdialog = []

View file

@ -26,6 +26,7 @@ func _physics_process(delta):
print("move down")
func _input(event):
if Global.cdialog.size() == 0:
if Global.cdialog.size() != 0 && Global.live == 1:
get_tree().root.remove_child(talk)
Global.cdialog = []

View file

@ -12,5 +12,6 @@ func _process(delta):
pass
func _input(event):
if Global.cdialog.size() == 0:
if Global.cdialog.size() != 0 && Global.live == 1:
get_tree().root.remove_child(talk)
Global.cdialog = []

View file

@ -132,6 +132,7 @@ func _pausemenu():
get_tree().root.remove_child(pmenu)
get_tree().root.add_child.call_deferred(bhud)
ispaused = false
pmenu = load("res://levels/ui/pause.tscn").instantiate()
Global.live = 1
func _exit():
Global.exitgame = false

View file

@ -10,8 +10,8 @@ func _ready():
cnf = $CanvasLayer/HBoxContainer/VBoxContainer/Cname
chealthf = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer/Label2
clevel = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2/Label2
_fetchdata()
$CanvasLayer/HBoxContainer2/VBoxContainer2/Exit.grab_focus()
_fetchdata()
#pass # Replace with function body.

View file

@ -45,5 +45,4 @@ func _input(event):
if isboss:
Global.bossready = true
Global.live = 1
Global.cdialog = []
press = false

View file

@ -25,7 +25,7 @@ func _on_body_entered(body):
if body.is_in_group("players") && Global.dificulty != 1:
if body.weakness == speciality:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
#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
@ -37,7 +37,7 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
else:
Input.start_joy_vibration(0,1,0,2)
#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
@ -49,10 +49,19 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
elif body.is_in_group("boss") && Global.dificulty != 1:
if body.weakness == 0:
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 == 0:
if body.weakness == speciality:
print("weakness")
#if body.is_in_group("players"):
# Global.live = 2

View file

@ -37,7 +37,7 @@ func _on_body_entered(body):
if body.is_in_group("players") && Global.dificulty != 1:
if body.weakness == speciality:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
#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
@ -49,7 +49,7 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
else:
Input.start_joy_vibration(0,1,0,2)
#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
@ -61,10 +61,19 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
elif body.is_in_group("boss") && Global.dificulty != 1:
if body.weakness == 0:
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 == 0:
if body.weakness == speciality:
print("weakness")
#if body.is_in_group("players"):
# Global.live = 2

View file

@ -2,6 +2,7 @@ extends Area2D
var velocity: Vector2 = Vector2()
var direction
var speed = 100
var speciality
var btype
var isvisible
var attack
@ -30,7 +31,7 @@ func _on_body_entered(body):
if body.is_in_group("players") && Global.dificulty != 1:
if body.weakness == 3:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
#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
@ -42,7 +43,7 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
else:
Input.start_joy_vibration(0,1,0,2)
#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
@ -53,11 +54,20 @@ func _on_body_entered(body):
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 == 0:
elif body.is_in_group("boss") && Global.dificulty != 1 && Global.cboss[1] != null:
if body.weakness == 3:
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 == 0:
if body.weakness == 3:
print("weakness")
#if body.is_in_group("players"):
# Global.live = 2

View file

@ -4,6 +4,7 @@ var direction
var speed = 100
var btype
var isvisible
var speciality
var attack
var crit
# Called when the node enters the scene tree for the first time.
@ -30,7 +31,7 @@ func _on_body_entered(body):
if body.is_in_group("players") && Global.dificulty != 1:
if body.weakness == 0:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
#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
@ -42,7 +43,7 @@ func _on_body_entered(body):
else:
Global.cstats[Global.party[Global.cpchar][0]][0] = 0
else:
Input.start_joy_vibration(0,1,0,2)
#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
@ -56,6 +57,15 @@ func _on_body_entered(body):
elif body.is_in_group("boss") && Global.dificulty != 1:
if body.weakness == 0:
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 == 0:
print("weakness")

View file

@ -93,6 +93,7 @@ func shoot(angle):
new_bullet.btype = "boss"
new_bullet.attack = attack
new_bullet.crit = crit
new_bullet.speciality = 3
get_parent().call_deferred("add_child",new_bullet)

View file

@ -8,10 +8,13 @@ var sprite
var anim
var speed
var csprite
var attack
var crit
var bpress = false
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var weakness
var speciality
func _ready():
add_to_group("players")
@ -72,6 +75,9 @@ func _input(event):
bullet = load(Global.pbbullets[Global.party[Global.cpchar][0]])
var new_pbullet = bullet.instantiate()
new_pbullet.btype = "players"
new_pbullet.attack = attack
new_pbullet.crit = crit
new_pbullet.speciality = speciality
new_pbullet.velocity = Vector2(0, -speed).rotated(deg_to_rad(angle * 90))
var rposition = Vector2(0, -96).rotated(deg_to_rad(angle * 90))
if angle == 2:
@ -86,10 +92,14 @@ func _input(event):
func _charinit():
if Global.debug:
speed = Global.mstats[Global.dparty[Global.dcpchar][0]][6]
attack = Global.mstats[Global.dparty[Global.dcpchar][0]][2]
crit = Global.mstats[Global.dparty[Global.dcpchar][0]][3]
#print(Global.dparty[Global.dcpchar][0])
#print(speed)
else:
speed = Global.mstats[Global.party[Global.cpchar][0]][6]
attack = Global.mstats[Global.party[Global.cpchar][0]][2]
crit = Global.mstats[Global.party[Global.cpchar][0]][3]
#print(Global.dparty[Global.cpchar][0])
#print(speed)
_charswitch()
@ -105,6 +115,7 @@ func _charswitch():
csprite = Global.dcpchar
sprite.texture = load(Global.pchars[Global.dparty[Global.dcpchar][0]][Global.dparty[Global.dcpchar][1]])
weakness = Global.specialities[Global.pcspecialities[Global.dparty[Global.dcpchar][0]]]
speciality = Global.pcspecialities[Global.dparty[Global.dcpchar][0]]
print(Global.dparty[Global.dcpchar][0])
print(speed)
else:
@ -117,3 +128,4 @@ func _charswitch():
csprite = Global.cpchar
sprite.texture = load(Global.pchars[Global.party[Global.cpchar][0]][Global.party[Global.cpchar][1]])
weakness = Global.specialities[Global.pcspecialities[Global.party[Global.cpchar][0]]]
speciality = Global.pcspecialities[Global.party[Global.cpchar][0]]