2 Replies - 2438 Views - Last Post: 15 August 2009 - 11:39 AM Rate Topic: -----

#1 gamejust4u   User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 214
  • Joined: 19-November 08

new game coding

Posted 14 August 2009 - 01:32 PM

Hey I'm slowly moving into C++ Dark GDK from C++. I know the format is different but I have error messages that I don't understand.

Error meesages: (for all functions)
gdk - game2\main.cpp(73) : error C3861: 'gameSetUp': identifier not found
: error C3861: 'playerSetup': identifier not found
: error C3861: 'playerReset': identifier not found

BY THE WAY: it's a card game

Here's the main code:
 /* Developer: Ada Cruz
Title: Rob Da Pack
Date: August 11, 2009
E-mail: [email protected] */

// Dark GDK - The Game Creators - www.thegamecreators.com

//  header file
#include "DarkGDK.h"
#include "Main.h"
#include "Enemies.h"
#include "input.h"
#include "Player.h"
#include "sound.h"
#include "text.h"

//declared variables
	int playerLives;
	float backdropSpeed;
	bool playerWin;
	bool enemiesTurn;
	int playerScore;

	//public prototypes
	void gameSetup(void);
	void gameReset(void);
	void gameTitle(void);
	void gameWaitTurn(void);
	void gameLevel(void);
	void gameLevelWait(void);
	void gamePlay(void);
	void gameDie(void);
	void gameWin(void);
	void gameOver(void);

//emumerator
		enum eMode {eGameSetup, eGameReset, eGameTitle, eGameWaitTurn, eGameLevel, eGameLevelWait, eGamePlay, eGameDie,
			eGameWin, eGameOver};

		eMode g_eGameMode = eGameSetup;

		int g_iLevel = 1;
		int g_ILevelStartTime = 0;


// the main entry point for the application is this function
void DarkGDK ( void )
{
	// turn on sync rate and set maximum rate to 60 fps
	dbSyncOn   ( );
	dbSyncRate ( 60 );

	// our main loop
	while ( LoopGDK ( ) )
	{
		//the Game
		game();

		// update the screen
		dbSync ( );
	}

	// return back to windows
	return;
}

	//Game loop
void game (void)
		{
			switch (g_eGameMode)
			{//initial setting of the game
			case eGameSetup:
				gameSetUp();
				break;

				//Resetting the game
			case eGameReset:
				gameReset();
				break;

				//Display main screen
			case eGameTitle:
				gameTitle();
				break;

				//Wait for turn
			case eGameWaitTurn:
				gameWaitTurn();
				break;

				//Display new level screen
			case eGameLevel:
				gameLevel();
				break;

				//Next level
			case eGameLevelWait:
				gameLevelWait();
				break;

				//game itself
			case eGamePlay:
				gamePlay();
				break;

				//Player loses game
			case eGameDie:
				gameDie();
				break;

				//Game over
			case eGameOver:
				gameOver();
				break;

			}
		}

//Game setup
void gameSetup()
{
	dbSetDisplayMode (1024,768,32);
	dbSyncOn();
	dbSyncRate (60);

	//Full Window
	dbMaximiseWindow();

	playerSetup();
	soundSetup();

	//Switch to game mode
	g_eGameMode = eGameTitle;
}

//Game title
void gameTitle()
{
	text ( 0 , 340 , 32 , "ROB DA PACK" , true , false );
	text ( 0 , 400 , 16 , "PRESS SPACE TO START" , true , false );
	// change the speed of background sound to give a different sound
	dbSetSoundSpeed ( 1 , 2000 ); 
	dbPlaySound ( 1 );
	// change the speed of backdrop scrolling again
	backdropSpeed = 2.0f;
	// set players starting lives to 5
	playerLives = 5;

	// reset player statistics and reset the level to 1 for a new game
	playerWin = false;
	enemiesTurn = false;
	playerReset();
	playerScore = 0;
	g_iLevel = 1;

	// wait for the user's turn
	g_eGameMode = eGameWaitTurn;
}

//Game reset
void gameReset()
{
	// stop the background sound playing
	dbStopSound ( 5 );
	// start the title screen sound and change the speed it plays back for a different effect
	dbSetSoundSpeed ( 1 , 2000 ); 
	dbPlaySound ( 1 );
	// change the speed the backdrops scroll at for a different visual effect
	backdropSpeed = 2.0f;

	// reset the player and enemies
	playerWin = false;
	enemiesTurn = false;
	playerReset();

	// set the mode to wait for the player to press fire
	g_eGameMode = eGameWaitTurn;

}

//Wait for turn
void gameWaitTurn()
{
	
	if ( checkTurn() )
	{
		// once player has made a match
		playerUpdateScore();
		// switch to display the level screen
		g_eGameMode = eGameLevel;
	}
}

// display the level screen
void gameLevel( void )
{
	// use our custom text routine to display the level
	char czLevel[20];
	sprintf ( czLevel , "LEVEL %d" , g_iLevel );
	text ( 0 , 340 , 32 , czLevel , true , true );
	// change the sound speed of sound 1 again to give a different twist on the sound
	dbSetSoundSpeed ( 1 , 8000 );
	dbPlaySound ( 1 );
	// change the scrolling speed of the backdrops
	backdropSpeed = 8.0f;
	// show the player lives on screen
	playerShowLives();

	// wait for the user to press fire
	g_eGameMode = eGameLevelWait;
}

// move the player up the screen until it passes out of view
void gameLevelWait( void )
{
	// has the player gone out of view?
	if ( playerLevelStart() == true )
	{
		// yes so switch to second stage
		g_eGameMode = eGameLevelWait2;
	}
}

// move the player from the bottom back to its normal position
void gameLevelWait2 ( void )
{
	// is the player in position?
	if ( playerLevelStart2() == true )
	{
		// yes so change the backdrop scrolling for the speed we want "in game"
		backdropSpeed = 1.0f;
		// update player score
		playerUpdateScore();
		// loop our atompsheric sound effect
		dbLoopSound ( 5 );
		// Lets store when the level starts so we can speed things up after a while to punish them for taking their time
		g_iLevelStartTime = dbTimer();
		// lets go play
		g_eGameMode = eGamePlay;
	}
}

 

This post has been edited by gamejust4u: 14 August 2009 - 01:52 PM


Is This A Good Question/Topic? 0
  • +

Replies To: new game coding

#2 stayscrisp   User is offline

  • フカユ
  • member icon

Reputation: 1040
  • View blog
  • Posts: 4,325
  • Joined: 14-February 08

Re: new game coding

Posted 14 August 2009 - 02:19 PM

Hi

You have used gameSetUp(); when it should be gameSetup(); with small case u.

Also you are calling functions that don't exist, at least in the code you gave. playerReset(); and playerSetup(); are not declared or defined.

Are you following a tutorial? if so can you link to it?
Was This Post Helpful? 1
  • +
  • -

#3 gamejust4u   User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 214
  • Joined: 19-November 08

Re: new game coding

Posted 15 August 2009 - 11:39 AM

View Poststayscrisp, on 14 Aug, 2009 - 01:19 PM, said:

Hi

You have used gameSetUp(); when it should be gameSetup(); with small case u.

Also you are calling functions that don't exist, at least in the code you gave. playerReset(); and playerSetup(); are not declared or defined.

Are you following a tutorial? if so can you link to it?



Thanks I understand now. I'm using the Dark Invader Game tutorial as a guide but I still have much to learn. Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1