Pong/Scenes/Pong.tscn
Fries 4200a3e7df add enemy ai to the game
the enemy can now track the player with a cast that uses a shape generated in code. the enemy moves using some fancy math that gets the sign of the distance between the ball and the enemy paddles y position to get a normalised number for velocity and the velocity is lerped to smooth out any janky movement.
2023-05-17 23:41:40 -07:00

27 lines
1.1 KiB
Text

[gd_scene load_steps=6 format=3 uid="uid://kmfgtiugs4m0"]
[ext_resource type="PackedScene" uid="uid://bklo6torhapa0" path="res://Scenes/Paddle.tscn" id="1_5rs0o"]
[ext_resource type="Script" path="res://Scripts/SceneManager.cs" id="1_m8437"]
[ext_resource type="PackedScene" uid="uid://cggi01qnnlnwg" path="res://Scenes/Ball.tscn" id="2_u2ksv"]
[ext_resource type="PackedScene" uid="uid://c5n541vsuvfk8" path="res://Scenes/Walls.tscn" id="3_jfis7"]
[ext_resource type="PackedScene" uid="uid://krt6x241s3x6" path="res://Scenes/Enemy.tscn" id="4_uwvof"]
[node name="Pong" type="Node2D"]
script = ExtResource("1_m8437")
[node name="Paddle" parent="." instance=ExtResource("1_5rs0o")]
position = Vector2(-350, 0)
_moveSpeed = 50.0
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(0, -2)
[node name="Ball" parent="." instance=ExtResource("2_u2ksv")]
_ballSpeed = 50.0
_maxRandomAngle = 0.42
[node name="Walls" parent="." instance=ExtResource("3_jfis7")]
[node name="Enemy" parent="." instance=ExtResource("4_uwvof")]
position = Vector2(350, 0)
_moveSpeed = 50.0