Pong/Scenes/Paddle.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

23 lines
837 B
Text

[gd_scene load_steps=5 format=3 uid="uid://bklo6torhapa0"]
[ext_resource type="PhysicsMaterial" uid="uid://e05n66x8ug77" path="res://BouncyMaterial.tres" id="1_76uik"]
[ext_resource type="Script" path="res://Scripts/Paddle.cs" id="1_uv7s3"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_iw3nx"]
size = Vector2(50, 75)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dbik4"]
size = Vector2(12, 150)
[node name="Paddle" type="RigidBody2D"]
physics_material_override = ExtResource("1_76uik")
gravity_scale = 0.0
lock_rotation = true
script = ExtResource("1_uv7s3")
[node name="Sprite" type="Sprite2D" parent="."]
scale = Vector2(0.25, 2)
texture = SubResource("PlaceholderTexture2D_iw3nx")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_dbik4")