instruction: حركة لاعب 2D احترافية مع تسارع وتباطؤ

output:
extends CharacterBody2D
@export var speed = 300
@export var accel = 20
func _physics_process(delta):
    var dir = Input.get_vector('left','right','up','down')
    velocity = velocity.move_toward(dir * speed, accel)
    move_and_slide()


instruction: كود قفز مزدوج (Double Jump)

output:
var jumps = 2
func _physics_process(delta):
    if is_on_floor(): jumps = 2
    if Input.is_action_just_pressed('jump') and jumps > 0:
        velocity.y = -400
        jumps -= 1


instruction: نظام إطلاق رصاصة في اتجاه الماوس

output:
func shoot():
    var b = bullet_scene.instantiate()
    get_tree().root.add_child(b)
    b.global_position = global_position
    b.rotation = (get_global_mouse_position() - global_position).angle()


instruction: نظام تلقي ضرر (Health System)

output:
signal health_depleted
var hp = 100:
    set(v):
        hp = clamp(v, 0, 100)
        if hp <= 0: health_depleted.emit()


instruction: عدو يتبع اللاعب باستخدام NavigationAgent2D

output:
func _physics_process(delta):
    nav_agent.target_position = player.global_position
    var next_path_pos = nav_agent.get_next_path_position()
    velocity = global_position.direction_to(next_path_pos) * speed
    move_and_slide()


instruction: كود شريط صحة (Progress Bar) يتحدث بنعومة

output:
func _process(delta):
    health_bar.value = lerp(health_bar.value, target_health, 0.1)


instruction: حفظ ملف اللعبة بصيغة JSON

output:
func save_game():
    var f = FileAccess.open('user://save.json', FileAccess.WRITE)
    f.store_string(JSON.stringify({'score': 100}))


instruction: هز الكاميرا (Screen Shake) عند الانفجار

output:
func shake(intensity):
    var tween = create_tween()
    tween.tween_property(camera, 'offset', Vector2(intensity, intensity), 0.1)
    tween.chain().tween_property(camera, 'offset', Vector2.ZERO, 0.1)


instruction: حركة لاعب 2D احترافية مع تسارع وتباطؤ

output:
extends CharacterBody2D
@export var speed = 300
@export var accel = 20
func _physics_process(delta):
    var dir = Input.get_vector('left','right','up','down')
    velocity = velocity.move_toward(dir * speed, accel)
    move_and_slide()


instruction: كود قفز مزدوج (Double Jump)

output:
var jumps = 2
func _physics_process(delta):
    if is_on_floor(): jumps = 2
    if Input.is_action_just_pressed('jump') and jumps > 0:
        velocity.y = -400
        jumps -= 1


instruction: نظام إطلاق رصاصة في اتجاه الماوس

output:
func shoot():
    var b = bullet_scene.instantiate()
    get_tree().root.add_child(b)
    b.global_position = global_position
    b.rotation = (get_global_mouse_position() - global_position).angle()


instruction: نظام تلقي ضرر (Health System)

output:
signal health_depleted
var hp = 100:
    set(v):
        hp = clamp(v, 0, 100)
        if hp <= 0: health_depleted.emit()


instruction: عدو يتبع اللاعب باستخدام NavigationAgent2D

output:
func _physics_process(delta):
    nav_agent.target_position = player.global_position
    var next_path_pos = nav_agent.get_next_path_position()
    velocity = global_position.direction_to(next_path_pos) * speed
    move_and_slide()


instruction: كود شريط صحة (Progress Bar) يتحدث بنعومة

output:
func _process(delta):
    health_bar.value = lerp(health_bar.value, target_health, 0.1)


instruction: حفظ ملف اللعبة بصيغة JSON

output:
func save_game():
    var f = FileAccess.open('user://save.json', FileAccess.WRITE)
    f.store_string(JSON.stringify({'score': 100}))


instruction: هز الكاميرا (Screen Shake) عند الانفجار

output:
func shake(intensity):
    var tween = create_tween()
    tween.tween_property(camera, 'offset', Vector2(intensity, intensity), 0.1)
    tween.chain().tween_property(camera, 'offset', Vector2.ZERO, 0.1)


instruction: حركة لاعب 2D احترافية مع تسارع وتباطؤ

output:
extends CharacterBody2D
@export var speed = 300
@export var accel = 20
func _physics_process(delta):
    var dir = Input.get_vector('left','right','up','down')
    velocity = velocity.move_toward(dir * speed, accel)
    move_and_slide()


instruction: كود قفز مزدوج (Double Jump)

output:
var jumps = 2
func _physics_process(delta):
    if is_on_floor(): jumps = 2
    if Input.is_action_just_pressed('jump') and jumps > 0:
        velocity.y = -400
        jumps -= 1


instruction: نظام إطلاق رصاصة في اتجاه الماوس

output:
func shoot():
    var b = bullet_scene.instantiate()
    get_tree().root.add_child(b)
    b.global_position = global_position
    b.rotation = (get_global_mouse_position() - global_position).angle()


instruction: نظام تلقي ضرر (Health System)

output:
signal health_depleted
var hp = 100:
    set(v):
        hp = clamp(v, 0, 100)
        if hp <= 0: health_depleted.emit()


instruction: عدو يتبع اللاعب باستخدام NavigationAgent2D

output:
func _physics_process(delta):
    nav_agent.target_position = player.global_position
    var next_path_pos = nav_agent.get_next_path_position()
    velocity = global_position.direction_to(next_path_pos) * speed
    move_and_slide()


instruction: كود شريط صحة (Progress Bar) يتحدث بنعومة

output:
func _process(delta):
    health_bar.value = lerp(health_bar.value, target_health, 0.1)


instruction: حفظ ملف اللعبة بصيغة JSON

output:
func save_game():
    var f = FileAccess.open('user://save.json', FileAccess.WRITE)
    f.store_string(JSON.stringify({'score': 100}))


instruction: هز الكاميرا (Screen Shake) عند الانفجار

output:
func shake(intensity):
    var tween = create_tween()
    tween.tween_property(camera, 'offset', Vector2(intensity, intensity), 0.1)
    tween.chain().tween_property(camera, 'offset', Vector2.ZERO, 0.1)


instruction: حركة لاعب 2D احترافية مع تسارع وتباطؤ

output:
extends CharacterBody2D
@export var speed = 300
@export var accel = 20
func _physics_process(delta):
    var dir = Input.get_vector('left','right','up','down')
    velocity = velocity.move_toward(dir * speed, accel)
    move_and_slide()


instruction: كود قفز مزدوج (Double Jump)

output:
var jumps = 2
func _physics_process(delta):
    if is_on_floor(): jumps = 2
    if Input.is_action_just_pressed('jump') and jumps > 0:
        velocity.y = -400
        jumps -= 1


instruction: نظام إطلاق رصاصة في اتجاه الماوس

output:
func shoot():
    var b = bullet_scene.instantiate()
    get_tree().root.add_child(b)
    b.global_position = global_position
    b.rotation = (get_global_mouse_position() - global_position).angle()


instruction: نظام تلقي ضرر (Health System)

output:
signal health_depleted
var hp = 100:
    set(v):
        hp = clamp(v, 0, 100)
        if hp <= 0: health_depleted.emit()


instruction: عدو يتبع اللاعب باستخدام NavigationAgent2D

output:
func _physics_process(delta):
    nav_agent.target_position = player.global_position
    var next_path_pos = nav_agent.get_next_path_position()
    velocity = global_position.direction_to(next_path_pos) * speed
    move_and_slide()


instruction: كود شريط صحة (Progress Bar) يتحدث بنعومة

output:
func _process(delta):
    health_bar.value = lerp(health_bar.value, target_health, 0.1)


instruction: حفظ ملف اللعبة بصيغة JSON

output:
func save_game():
    var f = FileAccess.open('user://save.json', FileAccess.WRITE)
    f.store_string(JSON.stringify({'score': 100}))


instruction: هز الكاميرا (Screen Shake) عند الانفجار

output:
func shake(intensity):
    var tween = create_tween()
    tween.tween_property(camera, 'offset', Vector2(intensity, intensity), 0.1)
    tween.chain().tween_property(camera, 'offset', Vector2.ZERO, 0.1)


instruction: حركة لاعب 2D احترافية مع تسارع وتباطؤ

output:
extends CharacterBody2D
@export var speed = 300
@export var accel = 20
func _physics_process(delta):
    var dir = Input.get_vector('left','right','up','down')
    velocity = velocity.move_toward(dir * speed, accel)
    move_and_slide()


instruction: كود قفز مزدوج (Double Jump)

output:
var jumps = 2
func _physics_process(delta):
    if is_on_floor(): jumps = 2
    if Input.is_action_just_pressed('jump') and jumps > 0:
        velocity.y = -400
        jumps -= 1


instruction: نظام إطلاق رصاصة في اتجاه الماوس

output:
func shoot():
    var b = bullet_scene.instantiate()
    get_tree().root.add_child(b)
    b.global_position = global_position
    b.rotation = (get_global_mouse_position() - global_position).angle()


instruction: نظام تلقي ضرر (Health System)

output:
signal health_depleted
var hp = 100:
    set(v):
        hp = clamp(v, 0, 100)
        if hp <= 0: health_depleted.emit()


instruction: عدو يتبع اللاعب باستخدام NavigationAgent2D

output:
func _physics_process(delta):
    nav_agent.target_position = player.global_position
    var next_path_pos = nav_agent.get_next_path_position()
    velocity = global_position.direction_to(next_path_pos) * speed
    move_and_slide()


instruction: كود شريط صحة (Progress Bar) يتحدث بنعومة

output:
func _process(delta):
    health_bar.value = lerp(health_bar.value, target_health, 0.1)


instruction: حفظ ملف اللعبة بصيغة JSON

output:
func save_game():
    var f = FileAccess.open('user://save.json', FileAccess.WRITE)
    f.store_string(JSON.stringify({'score': 100}))


instruction: هز الكاميرا (Screen Shake) عند الانفجار

output:
func shake(intensity):
    var tween = create_tween()
    tween.tween_property(camera, 'offset', Vector2(intensity, intensity), 0.1)
    tween.chain().tween_property(camera, 'offset', Vector2.ZERO, 0.1)