4.6, new attack, enemy spawning, shaders, bunch of stuff
This commit is contained in:
parent
e08e3ebb13
commit
19517a3176
84 changed files with 13348 additions and 91399 deletions
|
|
@ -1,31 +1,30 @@
|
|||
class_name Hitbox extends Area2D
|
||||
signal collided;
|
||||
|
||||
var from_player = true
|
||||
signal onhit;
|
||||
var hitplayer = false
|
||||
|
||||
#func _process(delta: float) -> void:
|
||||
#EventBus.cut_grass_at.emit(global_position, 14)
|
||||
var enabled = true
|
||||
|
||||
func _ready() -> void:
|
||||
collision_mask = 0xffff
|
||||
body_entered.connect(_on_body_entered)
|
||||
area_entered.connect(_on_area_entered)
|
||||
|
||||
func _on_area_entered(area : Area2D):
|
||||
if area is Hitbox:
|
||||
if area.from_player != from_player:
|
||||
collided.emit()
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
print(body)
|
||||
if not enabled: return
|
||||
if body is Enemy and from_player:
|
||||
var bname := str(body.name)
|
||||
body.damage()
|
||||
onhit.emit()
|
||||
collided.emit()
|
||||
body.knockback()
|
||||
EventBus.debug_print.emit("Hit: " + bname)
|
||||
|
||||
if body is Player and not from_player and not hitplayer:
|
||||
var bname := str(body.name)
|
||||
hitplayer = true
|
||||
if body is Player and not from_player:
|
||||
body.damage()
|
||||
onhit.emit()
|
||||
EventBus.debug_print.emit("Hit: " + bname)
|
||||
|
||||
EventBus.debug_print.emit(str(body))
|
||||
if body is StaticBody2D:
|
||||
onhit.emit()
|
||||
collided.emit()
|
||||
|
||||
if body is StaticBody2D or body is Hitbox:
|
||||
collided.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue