pongodot

Tinkering with Godot, remaking pong
git clone git://git.hellocld.com/pongodot
Log | Files | Refs

commit 0fcd8f961333ade99874e8cc876cf660ae248703
parent 41a815d80d2f95d3d8dbda88d10875570826a610
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Mon,  4 Nov 2019 15:59:22 -0500

Added some testing paddle movement stuff

Diffstat:
APaddle.gd | 12++++++++++++
MPaddle.tscn | 8+++++---
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Paddle.gd b/Paddle.gd @@ -0,0 +1,11 @@ +extends KinematicBody2D + +export var _speed = 32 + +func _physics_process(delta): + var vec = Vector2(0, 0); + if Input.is_action_pressed("ui_up"): + vec.y = -1 + if Input.is_action_pressed("ui_down"): + vec.y = 1 + move_and_collide(vec * _speed * delta)+ \ No newline at end of file diff --git a/Paddle.tscn b/Paddle.tscn @@ -1,14 +1,16 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://Assets/Sprites/Paddle.png" type="Texture" id=1] +[ext_resource path="res://Paddle.gd" type="Script" id=1] +[ext_resource path="res://Assets/Sprites/Paddle.png" type="Texture" id=2] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 64 ) [node name="Paddle" type="KinematicBody2D"] +script = ExtResource( 1 ) [node name="Sprite" type="Sprite" parent="."] -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 )