mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-30 07:51:54 +08:00
feat: Enhance game mechanics and structure
- Added `ColorBar` class for visual representation of values. - Expanded `EntityBase` with new properties: `isBoss` and `weapons`, and implemented damage handling and entity generation methods. - Updated `EntityStateBar` to use `ColorBar` for health representation. - Introduced `BulletBase` scene and script for bullet mechanics, including damage handling and generation. - Created `WorldTool` for managing the game world and root node. - Implemented `EntityTool` for retrieving entities from hurtboxes. - Added `GameRule` for managing game rules like friendly fire. - Updated scene files to reflect new structures and added necessary resources.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
class_name EntityTool
|
||||
|
||||
static func fromHurtbox(node: Node) -> EntityBase:
|
||||
if node is Area2D:
|
||||
var texture = node.get_parent()
|
||||
if texture is AnimatedSprite2D:
|
||||
var entity = texture.get_parent()
|
||||
if entity is EntityBase:
|
||||
return entity as EntityBase
|
||||
return null
|
||||
@@ -0,0 +1,3 @@
|
||||
class_name GameRule
|
||||
|
||||
static var allowFriendlyFire: bool = false # 是否允许友军伤害
|
||||
@@ -0,0 +1,9 @@
|
||||
extends Node2D
|
||||
class_name WorldTool
|
||||
|
||||
static var rootNode: Node2D
|
||||
static var tree: SceneTree
|
||||
|
||||
func _ready():
|
||||
tree = get_tree()
|
||||
rootNode = self
|
||||
Reference in New Issue
Block a user