Light Pong

Engine

Game Maker Studio

Language

GML

Time-span

3 uur

Game Jam

personal

Downloads

Samenvatting

Lightpong, ofwel een Pong-game met een neon-theme en een grote hoeveelheid animatie. Gemaakt gedurende een 3-uur durende gamejam als mini-project met als doel om een opname van het volledige development proces te maken.
x+=(cos(degtorad(dir))*spd);
y-=(sin(degtorad(dir))*spd);

//Wall Collision
if(collision_line(32,(room_height*0.1)-16,room_width-32,(room_height*0.1)-16,id,false,false))
{
    dir = scr_bounce(dir,270);
    dir+= irandom(10)-5;
    x+=(cos(degtorad(dir))*spd);
    y-=(sin(degtorad(dir))*spd);
}
else if(collision_line(32,(room_height*0.9)+16,room_width-32,(room_height*0.9)+16,id,false,false))
{
    dir = scr_bounce(dir,90);
    dir+= irandom(10)-5;
    x+=(cos(degtorad(dir))*spd);
    y-=(sin(degtorad(dir))*spd);
}

//Pad Collision
var _pad = instance_nearest(x,y,obj_pad), _px = _pad.x, _py = _pad.y;
if(collision_line(_px+(16*sign(_px-(room_width*0.5))),_py-64,_px+(16*sign(_px-(room_width*0.5))),_py+64,id,false,false) ||
    collision_line(_px,_py-64,_px+(16*sign(_px-(room_width*0.5))),_py-64,id,false,false) || 
    collision_line(_px,_py+64,_px+(16*sign(_px-(room_width*0.5))),_py+64,id,false,false))
{
    dir = scr_bounce(dir,point_direction(_px,_py,room_width*0.5,_py));
    dir-= y-_py;
    dir+= irandom(10)-5;
    dir = (dir+360)%360;
    
    x+=(cos(degtorad(dir))*spd);
    y-=(sin(degtorad(dir))*spd);
    spd*=1.01;
}

if(x > room_width+64)
{
    global.sc[0]++;
    x = room_width*0.5;
    y = room_height*0.5;
    event_perform(ev_create,ev_create);
}
else if(x < -64)
{
    global.sc[1]++;
    x = room_width*0.5;
    y = room_height*0.5;
    event_perform(ev_create,ev_create);
}
{
    ///scr_bounce(Direction, Normal);
    //
    // Bounce item
    //
    //-----------------------------
    
    var _oldDir, _newDir, _norm;
    
    _oldDir = argument[0];
    _norm = argument[1];
    
    //Calculating for a moment...
    _newDir = (_norm-(_oldDir+180))+_norm;
    _newDir = (_newDir+360)%360;
    _newDir = clamp(_newDir+360,min((_norm+285)%360,(_norm+75)%360),max((_norm+285)+360,(_norm+75)+360))%360;
    
    return _newDir;
}
///Backgrounds
var _x, _y, _bx, _by;

_bx = obj_ball.x;
_by = obj_ball.y;

draw_set_color(c_white);
draw_set_alpha(0.5);
for(_x = 0; _x < room_width+32; _x+=32)
{
    draw_primitive_begin(pr_linestrip);
    for(_y = 0; _y < room_height+32; _y+=32)
    {
        
        var _dist = point_distance(_x,_y,_bx,_by), _diri = point_direction(_x,_y,_bx,_by);
        var _trueDist = clamp(64-_dist,0,64), _rand = irandom_range(-clamp(1-floor(_dist/128),0,2),clamp(1-floor(_dist/128),0,2));
        draw_vertex(_x+_rand-(cos(degtorad(_diri))*_trueDist),_y+_rand+irandom_range(-1,1)+(sin(degtorad(_diri))*_trueDist));
    }
    draw_primitive_end();
}

for(_y = 0; _y < room_height+32; _y+=32)
{
    draw_primitive_begin(pr_linestrip);
    for(_x = 0; _x < room_width+32; _x+=32)
    {
        var _dist = point_distance(_x,_y,_bx,_by), _diri = point_direction(_x,_y,_bx,_by);
        var _trueDist = clamp(64-_dist,0,64), _rand = irandom_range(-clamp(1-floor(_dist/128),0,2),clamp(1-floor(_dist/128),0,2));
        draw_vertex(_x+_rand-(cos(degtorad(_diri))*_trueDist),_y+_rand+(sin(degtorad(_diri))*_trueDist));
    }
    draw_primitive_end();
}

draw_set_blend_mode(bm_subtract);
//Fade Around Pad
with(obj_pad)
{
    draw_circle_colour(x,y-64,64,c_white,c_black,false);
    draw_circle_colour(x,y+64,64,c_white,c_black,false);
    draw_rectangle_colour(x,y-64,x+16,y+64,c_white,c_black,c_black,c_white,false);
    draw_rectangle_colour(x,y-64,x-16,y+64,c_black,c_white,c_white,c_black,false);
}
//Walls
draw_rectangle_colour(0,0,room_width,96,c_white,c_white,c_black,c_black,false);
draw_rectangle_colour(0,room_height,room_width,room_height-96,c_black,c_black,c_white,c_white,false);
//Score
draw_circle_colour(room_width*0.45,128,16,c_white,c_gray,false);
draw_circle_colour(room_width*0.45,128,48,c_white,c_ltgray,false);

draw_circle_colour(room_width*0.55,128,16,c_white,c_gray,false);
draw_circle_colour(room_width*0.55,128,48,c_white,c_ltgray,false);
//Ball
draw_circle_colour(_bx,_by,64,c_white,c_ltgray,false);

draw_set_blend_mode(bm_add);
draw_circle(room_width*0.45,128,48,true);
draw_circle(room_width*0.55,128,48,true);
for(var _i = -1; _i <=1; _i++)
{
    draw_set_color(c_blue);
    draw_circle(room_width*0.45,128+_i,48,true);
    draw_set_color(c_red);
    draw_circle(room_width*0.55,128+_i,48,true);
}
draw_set_blend_mode(bm_normal);

Screenshots

Light Pong