/
xoptov
/
tanks
Обзор
Документация
Войти
/
xoptov
/
tanks
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/tank/shells/shell.gd
58 строк
966 B
Maksim Khortov
Переключил режим движка в Compatability
25 янв 2026, 13:04
25 янв 2026, 13:04
c4eb418
Код
Авторство
О чём код?
extends RigidBody2D var _start_speed = 700 var hit_stone = preload("res://scenes/design/bullet_shell.tscn") var bullet = Vector2.ZERO func _ready(): $Timer.start(4) _scene_desine() func _hit_position(): var collision_point = global_position _scene_node_animation(collision_point) func _scene_desine(): var hit_rock = hit_stone.instantiate() get_parent().add_child(hit_rock) return hit_rock func _scene_audi_desine(): var hit_rock = _scene_desine().get_node("hit_build") hit_rock.play() func _scene_node_animation(position: Vector2): var hit_effect = hit_stone.instantiate() get_tree().current_scene.add_child(hit_effect) hit_effect.global_position = position func _physics_process(delta): pass func _on_timer_timeout(): queue_free() func get_start_speed(): return _start_speed func _speed_hit(): var force = linear_velocity.length() return force func hit(): queue_free() func _on_body_entered(body): _hit_position() hit()