src/players.cpp
// This function sets all up to let players participate in the game.
// Everything related to player initialization is here.

This function sets all up to let players participate in the game.
Everything related to player initialization is here.
This function sets all up to let players participate in the game . Everything related to player initialization is here .
bool createPlayerObjects()
{
	playerUnitStruct playerData;
	playerList.resetList();
	setupPlayerUnit(playerData, FILE_GAMEDATA_PLAYER_JAVATAR);
	playerData.isPosRelative=true;
	playerData.xFromCamera=
		-(constructContainerFrame(&playerData).w-
		constructContainerFrame(&playerData).handlerX);
	playerData.yFromCamera=-50;
	playerData.x=playerData.xFromCamera;
	playerData.y=playerData.yFromCamera;
	playerData.goingToPoint=true;
	playerData.goingToPointX=200;
	playerData.goingToPointY=(gameWorld.hCamera-150)/2;
	setSpeedForLinealMove(
		&playerData,
		playerData.goingToPointX, playerData.goingToPointY,
		280/double(desiredFramesPerSecond));
	playerData.unarmedTimeLeft=
		int(0.2*double(desiredFramesPerSecond));
	playerData.linearSpeed=200/double(desiredFramesPerSecond);
	playerData.userControlled=true;
	playerData.keyUp=SDLK_UP;
	playerData.keyDown=SDLK_DOWN;
	playerData.keyLeft=SDLK_LEFT;
	playerData.keyRight=SDLK_RIGHT;
	playerData.keyShoot=KMOD_RCTRL;
	if (gameWorld.playersToStart<=1) {
		playerData.playerUseAllKeyboard=true;
	}else{
		playerData.playerUseAllKeyboard=false;
	}
	if (!playerList.isValidIndex(playerList.addNode(playerData))) {
		logger.logLine("Failed adding node to playerList");
		return false;
	}
	return true;
}
bool createPlayerObjects ( ) { playerUnitStruct playerData ; playerList . resetList ( ) ; setupPlayerUnit ( playerData , FILE_GAMEDATA_PLAYER_JAVATAR ) ; playerData . isPosRelative = true ; playerData . xFromCamera = - ( constructContainerFrame ( & playerData ) . w - constructContainerFrame ( & playerData ) . handlerX ) ; playerData . yFromCamera = -50 ; playerData . x = playerData . xFromCamera ; playerData . y = playerData . yFromCamera ; playerData . goingToPoint = true ; playerData . goingToPointX = 200 ; playerData . goingToPointY = ( gameWorld . hCamera - 150 ) / 2 ; setSpeedForLinealMove ( & playerData , playerData . goingToPointX , playerData . goingToPointY , 280 / double ( desiredFramesPerSecond ) ) ; playerData . unarmedTimeLeft = int ( 0.2 * double ( desiredFramesPerSecond ) ) ; playerData . linearSpeed = 200 / double ( desiredFramesPerSecond ) ; playerData . userControlled = true ; playerData . keyUp = SDLK_UP ; playerData . keyDown = SDLK_DOWN ; playerData . keyLeft = SDLK_LEFT ; playerData . keyRight = SDLK_RIGHT ; playerData . keyShoot = KMOD_RCTRL ; if ( gameWorld . playersToStart <= 1 ) { playerData . playerUseAllKeyboard = true ; } else { playerData . playerUseAllKeyboard = false ; } if ( ! playerList . isValidIndex ( playerList . addNode ( playerData ) ) ) { logger . logLine ( " " ) ; return false ; } return true ; }
This function sets all up to let players participate in the game.
This function sets all up to let players participate in the game .
// Add our players to the list
 // Drop the players from the list
 // Basic info
 // Set the relative position stuff (relative to camera)
 // are xFromCamera and yFromCamera used for relative position?
 // Coordinates
 // Set all up for the entrance
 // player unit
 // dest pos
 // linear speed
 // Don't let it shoot for the first portion of a second
 // Speed
 // Input info...
 // we are alone, let us use all the keyboard
 // if it's set, we can use special key codes for making many keys do for the same function
 // if it's set, we can use special key codes for making many keys do for the same function
 // Add this node
 // all ok
