It's an advanced game program he's the code erros:
I don't understand it not being able to complie the code? =/
Please Help Me!?!
//888888888888888888888888888888888
//* Vulture *
//888888888888888888888888888888888
#include "DarkGDk.h"
//Constants for the image numbers
const int TITLE_SCREEN_IMAGE = 1;
const int INTRO_SCREEN_IMAGE = 2;
const int EGG_IMAGE = 3;
const int BROKEN_EGG_IMAGE = 4;
const int FARM_IMAGE = 5;
const int BASKET_IMAGE = 6;
const int HIT_BASKET_IMAGE = 7;
const int VULTURE_IMAGE = 8;
//Constants for the sprite numbers
const int FARM_SPRITE = 1;
const int BASKET_SPRITE = 2;
const int EGG_SPRITE = 3;
const int HIT_BASKET_SPRITE = 4;
const int BROKEN_EGG_SPRITE = 5;
const int VULTURE_SPRITE = 6;
//Constants for the animated sprite
const int VULTURE_COLS = 4;
const int VULTURE_ROWS = 2;
const int START_FRAME = 1;
const int END_FRAME = 8;
//Constants for the sound numbers
const int POP_SOUND = 1;
const int CLAP_SOUND = 2;
const int TYPE_SOUND = 3;
const int COMPLETE_SOUND = 4;
const int PERFECT_SCORE_SOUND = 5;
//Constants for the music numbers
const int INTRO_MUSIC = 1;
const int MAIN_MUSIC = 2;
//Time delay constants
const int TENTH_SECOND = 100;
const int ONE_SECOND = 1000;
const int FOUR_SECONDS = 4000;
//Other constants
const int MAX_EGGS = 40; //Total eggs
const int BASKET_MOVE = 4; //Move the basket
const int VULTURE_MOVE = 2; //Amount to move vulture
const float ACCELERATION = 0.5; //Gravity acceleration
const int REFRESH_RATE = 60; //Refresh rate
//**********************
//* DarkGDK Function *
//**********************
void DarkGDK()
{
//Local variables
int eggs = MAX_EGGS; //# of eggs
int caught = 0;
int broken = 0;
int basketX, basketY;
int vultureX, vultureY;
int eggX, eggY;
int time = 0;
//Load game resources
loadResources();
intro();
//Create all Sprites
createSprites(basketX, basketY, eggX, eggY, vultureX, vultureY);
while ( LoopGDK() && eggs > 0 )
{
moveBasket(basketX);
moveVulture(vultureX);
//Move egg special
moveEgg(vultureX, vultureY, eggX, eggY, time);
//Render scene
render(basketX, basketY, eggX, eggY, vultureX, vultureY);
}
//Display Game Results Screen
summaryScreen(caught, broken);
}
//******************
//* Load Images *
//******************
void loadResources()
{
//Set the color key to black
dbSetImageColorKey(0, 0, 0);
dbLoadImage("titleScreen.bmp", TITLE_SCREEN_IMAGE);
dbLoadImage("intro.bmp", INTRO_SCREEN IMAGE);
dbLoadImage("farm.bmp", FARM_IMAGE);
dbLoadImage("egg.bmp", EGG_IMAGE);
dbLoadImage("brokenEgg.bmp", BROKEN_EGG_IMAGE);
dbLoadImage("basket.bmp", BASKET_IMAGE);
dbLoadImage("hitBasket.bmp", HIT_BASKET_IMAGE);
//Load intro music
dbLoadMusic("Vulture Intro.mid", INTRO_MUSIC);
dbLoadMusic("Vulture Level.mid", MAIN_MUSIC);
//Load sound effects
dbLoadSound("pop.wav", POP_SOUND);
dbLoadSound("clap.wav", CLAP_SOUND);
dbLoadSound("type.wav", TYPE_SOUND);
dbLoadSound("complete.wav", COMPLETE_SOUND);
dbLoadSound("vulturePerfect.wav", FERFECT_SCORE_SOUND);
}
//******************
//* Display Title *
//* Intro Screen *
//******************
void intro()
{
//For title
dbSetWindowTitle("Vulture Trouble");
dbLoopMusic(Intro_MUSIC);
dbPasteImage(TITLE_SCREEN_IMAGE, 0, 0);
dbCLS();
dbPasteImage(INTRO_SCREEN_IMAGE), 0, 0);
dbWaitKey();
dbCLS();
//For intro
dbPasteImage(INTRO_SCREEN_IMAGE, 0, 0);
dbWaitKey();
//Now end music
dbStopMusic(INTRO_MUSIC);
//Refresh Rate
dbSyncOn();
dbSyncRate(REFRESH_RATE);
}
//******************
//* Create ALL *
//* The Sprites *
//******************
void createSprites(int &basketX, int &basketY, int &eggX,
int &eggY, int &vulture, int &vultureY)
{
//Start at 0,0
dbSprite(FARM_SPRITE, 0, 0, FARM_IMAGE);
dbSprite(BASKET_SPRITE, 0, 0, BASKET_IMAGE);
dbSprite(EGG_SPRITE, 0, 0, EGG_IMAGE);
dbSprite(HIT_SPRITE, 0, 0, HIT_IMAGE);
dbSprite(BROKEN_EGG_SPRITE, 0, 0, BROKEN_EGG_IMAGE);
//Hide hit basket and broken egg sprites
dbHideSprite(HIT_BASKET_SPRITE);
dbHideSprite(BROKEN_EGG_SPRITE);
//Create animated Vulture sprite
dbCreateAnimatedSprite(VULTURE_SPRITE, "vulture.bmp")
VULTURE_COLS, VULTURE_ROWS,
VULTURE_IMAGE);
//Set starting position for Vulture
vultureX = dbScreenWidth() / 2 -
dbSpriteWidth(VULTURE_SPRITE) / 2;
vultureY = 0;
//Set starting position of egg to Vulture
eggX = vultureX + dbSpriteWidth(VULTURE_SPRITE) -
dbSpriteWidth(EGG_SPRITE);
eggY = vultureY + dbSpriteHeight(VULTURE_SPRITE) /2;
//Set basket starting x position to random location
dbRandomize( dbTimer() );
basketX = dbRND( dbScreenWidth() -
dbSpriteWidth(BASKET_SPRITE) );
//Set basket starting y position to random location
basketY = dbScreenHeight() -
dbSpriteWidth(BASKET_SPRITE);
//Clone egg sprite and display mini eggs at the
//top of the screen. The cloned mini eggs sprite
//numver will begin 101. PG 389
{
//Calculate a new sprite number
spriteNum = 100 + count;
//Clone the egg sprite
dbCloneSprite(EGG_SPRITE, spriteNum);
//Scale the sprite to 50%
dbScaleSprite(spriteNum, 50);
//Place the sprite in the status bar
dbSprite(spriteNum, dbSpriteWidth(EGG_SPRITE) / 2 * count), 0, EGG_IMAGE);
}
}
//****************************
//| Move Basket Function |
//****************************
void moveBasket(int &basketX)
{
//Check if left key is pressed
if ( dbLeftKey() )
{
//Stop basket at LEFT edge of screen
if (basketX <= 0)
{
basketX = 0;
}
//Move the basket left
else
{
basket -= BASKET_MOVE;
}
}
//Check if the right key is pressed
if( dbRightKey() )
{
//Stop the basket at the RIGHT edge of the screen
if (basketX + dbSpriteWidth(BASKET_SPRITE) >= dbScreenWidth())
{
basketX = dbScreenWidth() - dbSpriteWidth(BASKET_SPRITE);
}
//Move the basket right
else
{
basketX += BASKET_MOVE;
}
}
}
//****************************
//| Move Vulture Function |
//****************************
void moveVulture(int &vultureX)
{
//Play the vulture animation sequence
dbPlaySprite(VULTURE_SPRITE, START_FRAME, END_FRAME, TENTH_SECOND);
//Check vulture X position, if it is less than or equal to 0
//Mirror the vulture sprite.
if (vultureX <= 0)
{
dbMirrorSprite(VULTURE_SPRITE);
}
//Check vulture X position, if it is an right side of screen
//Mirror the vulture sprite.
if (vultureX + dbSpriteWidth(VULTURE_SPRITE) >= dbScreenWidth())
{
dbMirrorSprite(VULTURE_SPRITE);
}
//If the vulture is currently mirrored, move right
if ( dbSpriteMirrored(VULTURE_SPRITE) )
{
vultureX += VULTURE_MOVE;
}
//If vulture is not mirrored move left
else
{
vultureX -= VULTURE MOVE;
}
}
//****************************
//| Move Egg Function |
//| Also Uses Time Function |
//****************************
void moveEgg(int vultureX, int vultureY, int &eggX, int &eggY, int &time)
{
//Set local variable to hold falling distance
float distance;
//Set the egg's X position so it's below the vulture's beak.
//This will depend on whether the vulture is mirrored.
if( dbSpriteMirrored(VULTURE_SPRITE) )
{
eggX = vultureX + dbSpriteWidth(VULTURE_SPRITE) - dbSpriteWidth(EGG_SPRITE);
}
else
{
eggX = vultureX;
}
//Calculate the falling distance
distance = 0.5 * ACCELERATION * time * time;
//Update the Y position
eggY = distance + vultureY + dbSpriteHeight(VULTURE_SPRITE) / 2;
//Increment falling time
time++;
}
//****************************
//| Check Collision Function |
//| Between Egg & Basket |
//****************************
void checkCollision(int vultureY, int &eggY, int &caught, int &broken, int &eggs, int &time)
{
//This egg has hit the basket PG: 396
if (dbSpriteCollision(EGG_SPRITE, BASKET_SPRITE) )
{
// Increment number of caught eggs.
caught++;
// Decrement number of eggs in play.
eggs--;
// Show the hit basket effect.
showHitBasket();
// Reset the egg.
resetEgg(eggs, vultureY, eggY);
// Reset the falling time.
time = 0;
}
// The egg has missed the basket.
else if ( eggY > dbScreenHeight() )
{
//Increment the number of broken eggs.
broken++;
// Decrement the number of eggs in play.
eggs--;
// Show the borken egg effect.
showBrokenEgg();
//Reset the egg.
resetEgg(eggs, vultureY, eggY);
// Reset the falling time.
time = 0;
}
}
//**********************************
//| Shows showHitBasket function |
//|shows effect and plays pop sound|
//**********************************
void showHitBasket()
{
//Temporarily enables auto refresh
dbSyncOff();
//Shows the hit basket sprite
dbShowSprite(HIT_BASKET_SPRITE);
//Play the pop sound
dbPlaySound(POP_SOUND);
//Wait 10th of second
dbWait(TENTH_SECOND);
//Hide the hit basket sprite.
dbHideSprite(HIT_BASKET_SPRITE);
//Disable auto-refresh
dbSyncOn();
}
//**********************************
//| Shows showBrokenEgg function |
//| when the egg hits the ground |
//**********************************
void showBrokenEgg()
{
// Temporarily enable auto refresh.
dbSycnOff();
//Show the broken egg sprite.
dbShowSprite(BROKEN_EGG_SPRITE);
//Play the clap sound.
dbPlaySound(CLAP_SOUND);
//Wait for 10th second
dbWait(TENTH_SECOND);
// Hide the broken egg sprite.
dbHideSprite(BROKEN_EGG_SPRITE);
// Display auto refresh.
dbSyncOn();
}
//************************
//| resetEgg function |
//| After fall or catch |
//************************
void resetEgg(int eggs, int vultureY, int &eggY)
{
//If clone exists in status bar...delete it
if ( dbSpriteExist(eggs+100) )
{
dbDeleteSprite(eggs + 100);
}
//Wait for 10th second
dbWait(TENTH_SECOND);
//Reset the egg Y position
eggY= vultureY +
dbSpriteHeight(VULTURE_SPRITE)/2;
}
//**********************
//| Draw the screen |
//| Add all the images |
//**********************
void render(int basketX, int basketY, int eggX, int eggY, int vultureX, int vultureY)
{
//Draw the sprite.
dbSprite(BASKET_basketX, basketY, BASKET_IMAGE);
dbSprite(EGG_SPRITE, eggX, eggY, EGG_IMAGE);
dbSprite(HIT_BASKET_SPRITE, basketX, basketY, HIT_BASKET_IMAGE);
dbSprite(BROKEN_EGG_SPRITE, eggX, dbScreenHeight() - dbSpriteHeight(BROKEN_EGG_SPRITE), BROKEN_EGG_IMAGE);
dbSprite(VULTURE_SPRITE, vultureX, vultureY, VULTURE_IMAGE)
//Refresh the Screen
dbSync();
}
//***************************
//| summartScreen function |
//| shows player preformance|
//| points earned, each egg |
//| =1000 points |
//***************************
void summaryScreen(int caught, int broken)
{
//Delete the sprite and get them off the screen
deleteSprites();
//Enable auto refresh and clear the screen
dbSyncOff();
dbCLS();
//Set the text size.
dbSetText(36);
//Display the text
dbCenterText(dbScreenWidth()/2, 100, "GAME OVER!");
//Play the game complete sound
dbPlaysound(COMPLETE_SOUND);
//Wait four seconds for sound to finish
dbWait(FOUR_SECONDS);
//Count eggs caught abd tally score
for(int caughtCount = 0; caught Count <= caught; caughtCount++)
{
// Clear the screen
dbCLS();
//Pastethe image
dbPasteImage(EGG_IMAGE, 200, 240);
dbPasteImage(BROKEN_EGG_IMAGE, 300, 240);
//Display the text
dbCenterText(dbScreenWidth()/2,100, "GAME RESULTS");
dbText(240, 240, "x");
dbText(380, 240, "x");
dbText(260, 240, dbStr(caughtCount));
dbText(400, 240, dbStr(broken));
//Play the type sound
dbPlaySound(TYPE_SOUND);
//Wait for 10th second
dbWait(TENTH_SECOND);
//Display score (1000 for each egg)
dbCenterText(dbScreenWidth()/2, 400, dbStr(caughtCount * 1000));
}
//If no eggs were broken, display special message
{
//Display text
dbCenterText(dbScreenWidth()/2, 200, "PERFECT SCORE!");
//Play the sound
dbPlaySound(PERFECT_SCORE_SOUND);
//Wait 1 second
dbWait(ONE_SECOND);
}
//Wait 4 player to press key
dbWaitKey();
}
//***************************
//| deleteSprites function |
//***************************
void deleteSprites()
{
dbDeleteSprite(FARM_SPRITE);
dbDeleteSprite(BAsKET_SPRITE);
dbDeleteSprite(EGG_SPRITE);
dbDeleteSprite(HIT_BASKET_SPRITE);
dbDeleteSprite(BROKEN_EGG_SPRITE);
dbDeleteSprite(VULTURE_SPRITE);
}
[b]AND HERE ARE THE ERRORS IT SAYS I HAVE[b]
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(68) : error C3861: 'loadResources': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(70) : error C3861: 'intro': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(73) : error C3861: 'createSprites': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(77) : error C3861: 'moveBasket': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(78) : error C3861: 'moveVulture': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(81) : error C3861: 'moveEgg': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(84) : error C3861: 'render': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(88) : error C3861: 'summaryScreen': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(99) : error C2065: 'INTRO_SCREEN' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(99) : error C2146: syntax error : missing ')' before identifier 'IMAGE'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(99) : error C2059: syntax error : ')'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(115) : error C2065: 'FERFECT_SCORE_SOUND' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(125) : error C2065: 'Intro_MUSIC' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(128) : error C2661: 'dbPasteImage' : no overloaded function takes 1 arguments
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(128) : error C2059: syntax error : ')'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(154) : error C2065: 'HIT_SPRITE' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(154) : error C2065: 'HIT_IMAGE' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(162) : error C2660: 'dbCreateAnimatedSprite' : function does not take 2 arguments
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(163) : error C2146: syntax error : missing ';' before identifier 'VULTURE_COLS'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(164) : error C2059: syntax error : ')'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(167) : error C2065: 'vultureX' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(172) : error C2065: 'vultureX' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(190) : error C2065: 'spriteNum' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(190) : error C2065: 'count' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(193) : error C2065: 'spriteNum' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(196) : error C2065: 'spriteNum' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(199) : error C2065: 'spriteNum' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(199) : error C2065: 'count' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(199) : error C2059: syntax error : ')'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(219) : error C2065: 'basket' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(269) : error C2065: 'VULTURE' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(269) : error C2146: syntax error : missing ';' before identifier 'MOVE'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(269) : error C2065: 'MOVE' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(318) : error C3861: 'showHitBasket': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(321) : error C3861: 'resetEgg': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(336) : error C3861: 'showBrokenEgg': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(339) : error C3861: 'resetEgg': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(376) : error C3861: 'dbSycnOff': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(419) : error C2065: 'BASKET_basketX' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(426) : error C2146: syntax error : missing ';' before identifier 'dbSync'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(437) : error C3861: 'deleteSprites': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(444) : error C3861: 'dbSetText': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(450) : error C3861: 'dbPlaysound': identifier not found
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(456) : error C2146: syntax error : missing ';' before identifier 'Count'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(456) : error C2065: 'Count' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(456) : error C2146: syntax error : missing ')' before identifier 'caughtCount'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(456) : error C2059: syntax error : ';'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(456) : error C2059: syntax error : ')'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(457) : error C2143: syntax error : missing ';' before '{'
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(469) : error C2065: 'caughtCount' : undeclared identifier
1>f:\c++\c++ new\31-40 god programs\the vulture trouble game\the vulture game\the vulture game\the main game.cpp(479) : error C2065: 'caughtCount' : undeclared identifier

New Topic/Question
Reply



MultiQuote







|