set_automatic_draw(0);
for(i=0; i<2000; i+=1)
{
draw_clear(c_ltgray);
draw_set_color(c_black);
drawstr=string_upper(chr(floor(65 + random(91-65))));
if i>1200 drawstr="H";
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text_transformed(room_width/2,room_height/2-100,drawstr,min(i,800)/100,min(i,800)/100,min(360,i/2.5));
draw_text_transformed(room_width/2,room_height/2+100,"A Game By Hockeyflyers",2,2,0);
draw_text_transformed(room_width/2,room_height/2+180,"Pushing the limits. As the One Script Games get more complex, one day#there could be 3d OSGs!",1,1,0);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
screen_refresh();
}
while 1
{
for(i=3; i>0; i-=1)
{
squX[i]=16*i;
squY[i]=16;
oldSquX[i]=16
i-1);
oldSquY[i]=16;
}
score=0;
Speed=0;
dirX=16;
dirY=0;
dotX=floor(random(room_width)/16)*16;
dotY=floor(random(room_height)/16)*16;
parts=3;
addPart=false;
rnd=false;
screen_refresh();
while 1
{
if keyboard_check_direct(vk_escape)break;
if keyboard_check_direct(ord("1"))
{
Speed=200;
break;
}
if keyboard_check_direct(ord("2"))
{
Speed=125;
break;
}
if keyboard_check_direct(ord("3"))
{
Speed=50;
break;
}
window_set_caption("Snake OSG. Hold <escape> key exit. [P] to pause");
draw_set_color(c_white);
draw_clear(c_black);
draw_set_halign(fa_center);
draw_text_transformed(320,10,"SNAKE OSG",7,7,0);
draw_text_transformed(320,140,"By Hockeyflyers",2,2,0);
draw_text_transformed(380,185,"Based off Zephiel87's Pong OSG",1,1,0);
draw_text_transformed(320,380,"Press [1] For Slow Speed",1.5,1.5,0);
draw_text_transformed(320,400,"Press [2] For Medium Speed",1.5,1.5,0);
draw_text_transformed(320,420,"Press [3] For High Speed",1.5,1.5,0);
draw_set_halign(fa_left);
draw_text_transformed(0,250,"Hold Escape At Anytime to Exit.",1.5,1.5,0);
draw_text_transformed(0,270,"Press [P] Key During the Game to Pause.",1.5,1.5,0);
screen_refresh();
}
while 1
{
draw_clear(c_ltgray);
draw_set_color(c_white);
for(a=0; a<room_height; a+=16)
{
draw_line(0,a,room_width,a);
}
for(a=0; a<room_width; a+=16)
{
draw_line(a,0,a,room_height);
}
draw_set_color(c_green);
draw_circle(dotX+8,dotY+8,8,false);
for(i=parts; i>0; i-=1)
{
oldSquX[i]=squX[i];
oldSquY[i]=squY[i];
if i==parts
{
draw_set_color(c_red);
squX[i]+=dirX;
squY[i]+=dirY;
if squX[i]==dotX && squY[i]==dotY
{
score+=100;
addPart=true;
dotX=floor(random(room_width)/16)*16;
dotY=floor(random(room_height)/16)*16;
}
for(a=parts-1; a>0; a-=1)
{
if (oldSquX[a]==squX[parts] && oldSquY[a]==squY[parts] || oldSquY[a]==squY[parts] && oldSquX[a]==squX[parts])
rnd=true;
}
}
else
{
draw_set_color(c_dkgray);
squX[i]=oldSquX[i+1];
squY[i]=oldSquY[i+1];
}
draw_rectangle(squX[i]+1,squY[i]+1,squX[i]+15,squY[i]+15,false);
screen_refresh();
}
if rnd==true
{
rnd=false;
show_message("One Script Snake#By Hockeyflyers##Game Over.#Your score is: "+string(score));
break;
}
if addPart==true
{
parts+=1;
for(i=parts; i>1; i-=1)
{
squX[i]=squX[i-1];
squY[i]=squY[i-1];
oldSquX[i]=oldSquX[i-1];
oldSquY[i]=oldSquY[i-1];
}
squX[1]=oldSquX[2];
squY[1]=oldSquY[2];
oldSquX[1]=129467; //it doesn't matter here...
oldSquY[1]=1; //here, either...
addPart=false;
}
if keyboard_check_direct(vk_down) && dirY!=-16 {dirX=0; dirY=16;}
if keyboard_check_direct(vk_up) && dirY!=16 {dirX=0; dirY=-16;}
if keyboard_check_direct(vk_left) && dirX!=16 {dirX=-16; dirY=0;}
if keyboard_check_direct(vk_right) && dirX!=-16 {dirX=16; dirY=0;}
if (squX[parts]>room_width || squX[parts]<0 || squY[parts]>room_height || squY[parts]<0)
{
show_message("One Script Snake#By Hockeyflyers##Game Over.#Your score is: "+string(score));
break;
}
sleep(Speed);
if keyboard_check_direct(ord('P'))
{
p_menu=show_message_ext("One Script Snake#By Hockeyflyers##Pause.#Your score is: "+string(score)+"##Press <escape> at anytime to exit.","Continue",noone,"Menu");
if p_menu==3
{
break;
}
}
if keyboard_check_direct(vk_escape)break;
}
if keyboard_check_direct(vk_escape)
break;
}
for(i=0; i<500; i+=1)
{
draw_clear(c_ltgray);
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text_transformed(room_width/2,room_height/2,"This has been Snake OSG by Hockeyflyers",2,2,0);
draw_text(room_width/2,room_height/2+100,"Hope you enjoyed it!");
draw_set_halign(fa_left);
draw_set_valign(fa_top);
screen_refresh();
}
game_end();