Okay, I tried it out and... well, thanks, it does work better on some walls. However, it's still not entirely bug-proof... it's supposed to bounce at the correct angle and mainly slide along walls. Anyone know how this code could be improved?

Code:

function ball_event
{
my_motion.x = -my_motion.x;
my_motion.y = -my_motion.y;

my_motion.x *= 0.5;
my_motion.y *= 0.5;
vec_to_angle(temp, bounce);
if(temp.pan > -1) && (temp.pan < 181)
{
my_motion.x += cos(temp.pan)*(vec_length(my_motion));
my_motion.y -= sin(temp.pan)*(vec_length(my_motion));
}
else
{
my_motion.x -= cos(temp.pan)*(vec_length(my_motion));
my_motion.y += sin(temp.pan)*(vec_length(my_motion));
}
}

action ball
{
ball_object = my;
my.event = ball_event;
my.enable_block = on;
my.enable_entity = on;
var space_on;
while(1)
{
proc_late();
ball_pan1.pos_x = int(my.x) - 32;
ball_pan1.pos_y = table_panel.pos_y + (2048 - int(my.y)) - 32;
my_motion.z = 0;
my_motion.y -= 0.25 * time;
if(key_space) && (space_on == off)
{
space_on = on;
my_motion.x -= 15 * time;
}
if(!key_space)
{
space_on = off;
}
c_move(my, nullvector, my_motion, ignore_passents+activate_trigger+use_aabb);
if(my.x < 0){my.x = 0;}
if(my.x > 1024){my.x = 1024;}
if(my.y < 0){my.y = 0;}
if(my.y > 2048){my.y = 2048;}
my_motion.x += key_cur*0.5*time;
my_motion.x -= key_cul*0.5*time;
my_motion.y += key_cuu*0.5*time;
my_motion.y -= key_cud*0.5*time;
wait(1);
}
}