#EnemyAttack
スクリプトもどんどん小分けに実装になってる
EnemyCore(敵スクリプト全体アクセス)
EnemyVital(敵のHP管理スクリプト)
EnemyBrain(動作の判定)
EnemyMotor(NavMeshAgentの操作)
EnemyAttack(選択された攻撃アニメーションの再生命令を出す)
EnemyAnimationRelay(アニメーションイベントを受け取る)
EnemyAnimationDriver(移動アニメーション関係)
EnemyAudioController(敵の効果音再生関係)
EnemyDamageReceiver(当たり判定)
とかになってきた…😢
April 2, 2026 at 7:49 AM
🎮 Ready for the Challenge? 🎮
You'll have to stay sharp and strategize, because the enemies are coming for you! 🛡️⚔️
Are you prepared to defend yourself and emerge victorious? 🚀

#indiedev #ChallengeAccepted #EnemyAttack #StaySharp #GearsofGlory #smashthecircuits #saturdayscreenshoot
January 11, 2025 at 9:43 AM
Help with State Machine transitions
### Godot Version 4.3 ### Question ` I have an enemy NPC scorpion that has State machine node with various states as children such as EnemyIdle, EnemyAttack etc. and I’m trying to transition to the EnemyDead when health <= 0. The enemy health is managed in script attached to the character node. The states I have all extend State so when transferring between states I use Transitioned.emit(self, “#stateNameHere”) but in the health management area I can’t simply put Transitioned as “Transitioned” is not declared in current scope. I’ve just been stuck on how to link the state machine to the main enemy script. Sorry if this doesn’t make a lot of sense I’m on my last brain cell at this point. StateMachine script: extends Node @export var initial_state: State var current_state : State var states : Dictionary = {} func _ready(): for child in get_children(): if child is State: states[child.name.to_lower()] = child child.Transitioned.connect(on_child_transition) if initial_state: initial_state.Enter() current_state = initial_state func _process(delta): if current_state: current_state.Update(delta) func _physics_process(delta): if current_state: current_state.Physics_Update(delta) func on_child_transition(state, new_state_name): if state != current_state: return var new_state = states.get(new_state_name.to_lower()) if !new_state: return if current_state: current_state.Exit() new_state.Enter() current_state = new_state Enemy NPC script: extends CharacterBody2D class_name Scorpion var max_health = 36 var health = 36 var state_machine: Node func _physics_process(delta: float) → void: if velocity.length() > 0: $AnimatedSprite2D.play("IdleWalk") if velocity.x > 0: $AnimatedSprite2D.flip_h = false else: $AnimatedSprite2D.flip_h = true move_and_slide() func _ready() → void: health = max_health state_machine = $StateMachine func _on_hurt_box_area_entered(hitbox: Hitbox): health -= hitbox.damage if health <= 0: pass Is there any easy way to transition to the EnemyDead state? Thanks for any help. I’m trying to learn as I go while looking at fundamentals on the side but the time I’m able to learn/practice has large gaps in between so retention has been an issue.
forum.godotengine.org
January 29, 2025 at 11:14 PM
Loading NPC Data from JSON File (Dictionary)
Yeah, that was a tpyo… I wasn’t using my code, I was just explaining what the JSON file looked like… This is my JSON file: { "Anon22310001": { "EnemyCountry": "United States", "EnemyIP": "192.168.132.140", "EnemyMoney": 495, "EnemyLevel": 1, "EnemyXP": 0, "EnemyNexp": 100, "EnemyCloudSpace": 200, "EnemyAttack": 9, "EnemyPenetration": 4, "EnemyDefense": 9, "EnemySurvellience": 1, "EnemyHealth": 225, "EnemyDamage": 8 }, "Anon22002193": { "EnemyCountry": "United Kingdom", "EnemyIP": "192.168.220.342", "EnemyMoney": 750, "EnemyLevel": 2, "EnemyXP": 0, "EnemyNexp": 100, "EnemyCloudSpace": 200, "EnemyAttack": 11, "EnemyPenetration": 5, "EnemyDefense": 11, "EnemySurvellience": 2, "EnemyHealth": 270, "EnemyDamage": 11 } } However I don’t think my error is with the JSON File. The error is thrown in my NPCs.gd (load_enemy_data func): func load_enemy_data(file_path: String) -> void: var file = FileAccess.open(file_path, FileAccess.READ) print("FILE OPENED...") if file: var json_data = JSON.parse_string(file.get_as_text()) print("WHETHER SUCCESSFUL OR NOT JSON PARSED...") if json_data.error == OK: print("IS JSON_DATA MORE THAN 0?") if typeof(json_data.result) == TYPE_DICTIONARY: enemy_data_dict = json_data.result print("Loaded Enemy Data Successfully") file.close() else: print("JSON Error: Parsed Data is not a Dictionary") else: print("Error parsing JSON: ", json_data.error_string) file.close() else: print("Failed to open File: ", file_path) All of my print("Wierd data within print) is just to debug so I know where the problem is… > I read the docs, and unless I understood it wrong, JSON.parse_string() doesn’t allow you to use (json_data.error)… Specifically .error cannot be used in a parse_string() func… I need to use JSON.parse() func in order to use .error == OK but I am still struggling to do that… Lol
forum.godotengine.org
December 8, 2024 at 6:39 AM