system.vc:
#define MENUNUM 5
#define MENUBACKCOLOR RGB(0, 0, 140)
#define MENUSELECTORCOLOR RGB(255, 255, 255)
//menu
int font;
string menuitems[MENUNUM];
string title;
int itemselected = 0;
//sounds
int click;
int beep;
//player
int player;
int playergravity = 0.5;
int playervspeed = 0;
void autoexec()
{
InitMenu();
}
void InitMenu()
{
//setup menu
font = LoadFont("files\font.pcx");
EnableVariableWidth(font);
title = "Platformer";
menuitems[0] = "New";
menuitems[1] = "Load";
menuitems[2] = "Options";
menuitems[3] = "Help";
menuitems[4] = "Exit";
//setup sounds
click = LoadSound("files\click.wav");
beep = LoadSound("files\beep.wav");
//setup buttons
SetButtonKey(1, SCAN_F);
SetButtonKey(2, SCAN_D);
HookKey(SCAN_UP, "DecrementSelector");
HookKey(SCAN_DOWN, "IncrementSelector");
HookKey(SCAN_ESC, "ExitGame");
HookButton(1, "SelectMenuItem");
//setup screen
SetAppName(title);
//setup main loop
HookTimer("DrawMenu");
while(1)
{
UpdateControls();
ShowPage();
}
}
void DrawMenu()
{
int titlex = ImageWidth(screen) / 2;
int titley = ImageHeight(screen)/8;
int menuy = ImageHeight(screen) / 3;
int rectleft;
int rectright;
int recttop;
int rectbottom;
RectFill(0, 0, ImageWidth(screen) - 1, ImageHeight(screen) - 1, MENUBACKCOLOR, screen);
PrintCenter(titlex, titley, screen, font, title);
int i;
for(i = 0; i < MENUNUM; i++)
{
PrintCenter(titlex, menuy + (i * FontHeight(font) * 2), screen, font, menuitems[i]);
if (itemselected == i)
{
rectleft = titlex - (TextWidth(font, menuitems[i]) / 2);
rectbottom = menuy + (i * FontHeight(font) * 2) + (FontHeight(font) / 2);
rectright = titlex + (TextWidth(font, menuitems[i]) / 2);
recttop = menuy + (i * FontHeight(font) * 2) + (FontHeight(font) / 2);
Rect(rectleft - 2, recttop - 8, rectright + 0, rectbottom + 5, MENUSELECTORCOLOR, screen);
}
}
}
void IncrementSelector()
{
Unpress(6);
itemselected += 1;
if (itemselected >= MENUNUM)
{
itemselected = 0;
}
PlaySound(click, 100);
}
void DecrementSelector()
{
Unpress(5);
itemselected -= 1;
if (itemselected <= -1)
{
itemselected = MENUNUM - 1;
}
PlaySound(click, 100);
}
void SelectMenuItem()
{
Unpress(1);
PlaySound(beep, 100);
switch (itemselected)
{
case 0:
StartGame();
case 1:
MessageBox("Load Game");
case 2:
MessageBox("Options");
case 3:
MessageBox("Help");
case 4:
ExitGame();
}
}
void StartGame()
{
//clear menu stuff
HookTimer("");
HookKey(SCAN_UP, "");
HookKey(SCAN_DOWN, "");
//actually start the game
Map("start.map");
}
void ExitGame()
{
Exit("");
}
start.vc:
void Start()
{
player = EntitySpawn(curmap.startx, curmap.starty, "darin.chr");
SetPlayer(player);
entity.obstruct[player] = 1;
}
The character is fine, the map is set up correctly, but all of a sudden I get an error on the last line of system.vc it says "expected ";" but got "." when it's just a "}"
So that means there's a problem somewhere else... I just don't see it. Help please?