15 game.player_dir =
std.key.press.down -
std.key.press.up
24 if game.ball_pos_y >= (
game.height -
game.ball_size) then
27 if game.ball_pos_y <= 0 then
30 if game.ball_pos_x <= 0 then
32 local new_spd_y =
std.math.clamp(
game.ball_spd_y + (
game.player_pos % 10) - 5, -10, 10)
33 game.ball_spd_y =
game.ball_spd_y == 0 and new_spd_y == 0 and 20 or new_spd_y -- WOW!
34 game.ball_spd_y =
game.ball_spd_y / 16
35 game.ball_spd_x =
std.math.abs(
game.ball_spd_x) * 1.003
44 std.draw.clear(
std.color.black)
45 std.draw.color(
std.color.white)
46 std.draw.rect(0, 4,
game.player_pos, 8,
game.player_size)
48 std.draw.font(
'Tiresias', 32)
60 author=
'RodrigoDornelles',
61 description=
'simple pong',
local function draw(std, game)
local function init(std, game)
local function exit(std, game)
local function loop(std, game)