image thumbnail

Snake3D

by

 

01 May 2012 (Updated )

3-dimensional version of the classic Snake. playsnake starts the game!!! Takes some practice.

playsnake.m
callstr = 'set(gcbf,''Userdata'',double(get(gcbf,''Currentcharacter''))) ; uiresume ' ;
x = get(0,'ScreenSize');
sw = x(3);
sh = x(4);

fh = figure('keypressfcn',callstr, ...
    'windowstyle','modal',...
    'position',[1 1 sw sh],...
    'Name','SpaceSnake', ...
    'userdata','timeout');
whitebg('g')
set(gcf,'Color','g')
uicontrol('Style','Text', ...
    'String','SNAKE3D',...
    'Position',[1 .1*sh sw .75*sh], ...
    'ForegroundColor','y', ...
    'BackgroundColor','b', ...
    'HorizontalAlignment','center', ...
    'FontSize', 100);
uicontrol('Style','Text', ...
    'String','Made By DooKE',...
    'Position',[.4*sw .6*sh .15*sw .05*sh], ...
    'ForegroundColor','r', ...
    'BackgroundColor','b', ...
    'FontWeight','bold', ...
    'FontSize', 10);
uicontrol('Style','Text', ...
    'String','New Game (Press 1)',...
    'Position',[.2*sw .25*sh .1*sw .075*sh], ...
    'ForegroundColor','y', ...
    'BackgroundColor','k', ...
    'FontSize', 15);
uicontrol('Style','Text', ...
    'String','  Practice   (Press 2)',...
    'Position',[.4*sw .25*sh .1*sw .075*sh], ...
    'ForegroundColor','y', ...
    'BackgroundColor','k', ...
    'FontSize', 15);
uicontrol('Style','Text', ...
    'String','About DOOKIE (Press 3)',...
    'Position',[.6*sw .25*sh .125*sw .075*sh], ...
    'ForegroundColor','y', ...
    'BackgroundColor','k', ...
    'FontSize', 15);
a=0;
while a==0
    uiwait
    ch = get(fh,'Userdata');
    switch ch
        case 49
            delete(fh)
            SpaceSnake
        case 50
            a=1;
            delete(fh)
            snake3dextra
        case 51
            a=2;
            delete(fh)
            snake3dextra
    end
end

Contact us