Adding initial game files.
This commit is contained in:
parent
8a5d7f634c
commit
c5615cbdd8
12 changed files with 229 additions and 0 deletions
18
Paddle.gd
Normal file
18
Paddle.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
const SPEED: float = 350.0
|
||||
|
||||
@export var player_id: int
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('up-%d' % player_id):
|
||||
velocity = Vector2(0, -SPEED)
|
||||
if event.is_action_pressed( 'down-%d' % player_id):
|
||||
velocity = Vector2(0, SPEED)
|
||||
if event.is_action_released('up-%d' % player_id) or \
|
||||
event.is_action_released('down-%d' % player_id):
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
move_and_slide()
|
||||
Loading…
Add table
Add a link
Reference in a new issue