File size: 1,575 Bytes
76a9097
 
 
 
 
1
2
3
4
5
6
{"instruction": "نظام سلاح كامل (إطلاق، ذخيرة، إعادة تعبئة)", "output": "extends Node2D\nvar ammo = 30\nvar max_ammo = 30\nfunc shoot():\n    if ammo > 0:\n        ammo -= 1\n        spawn_bullet()\n    else:\n        reload()\nfunc reload():\n    await get_tree().create_timer(1.5).timeout\n    ammo = max_ammo"}
{"instruction": "نظام حقيبة أدوات (Inventory) مبسط", "output": "var inventory = []\nfunc add_item(item_id):\n    inventory.append(item_id)\n    print('Item added: ', item_id)\nfunc has_item(item_id):\n    return item_id in inventory"}
{"instruction": "نظام حالات العدو (مطاردة، دورية، هجوم)", "output": "enum State {IDLE, CHASE, ATTACK}\nvar current_state = State.IDLE\nfunc _physics_process(delta):\n    match current_state:\n        State.IDLE: patrol()\n        State.CHASE: follow_player()\n        State.ATTACK: hit_player()"}
{"instruction": "نظام عرض نصوص حوارية متقدم", "output": "var lines = ['مرحباً بك', 'هل أنت مستعد؟']\nvar current_line = 0\nfunc show_next_text():\n    if current_line < lines.size():\n        label.text = lines[current_line]\n        current_line += 1"}
{"instruction": "كود التفاعل مع الأبواب والأدوات", "output": "func _input(event):\n    if event.is_action_pressed('interact'):\n        var targets = get_tree().get_nodes_in_group('interactable')\n        for t in targets:\n            if global_position.distance_to(t.global_position) < 50:\n                t.interact()"}