Wizard Fu's Cocos2dx Platformer Game Engine v1.0.1

nat@wizardfu.com

See the file LICENSE for the license governing this code.

This file contains the constant settings, tags and other enumerations used by the game.

#pragma once

#define kEnableScripting 1
#define kDrawDebugBoxes 0
#define kLogConstructDestruct 0
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	#define kDoOnScreenButtons 1
#else
	#define kDoOnScreenButtons 0
#endif

const char* const kSaveKeyPrefix = "";
static bool kSkipTitle = false;
const bool kSaveOnExit = false;
const bool kShowFPS = false;
const float kUpdatesPerSecond = 60.0f;
const float kIdealInterval = (1.0f / kUpdatesPerSecond);
const float kTicksPerSecond = 60;
const float kSecondsPerTick = 1.0f / kTicksPerSecond;
const float kPhysicsGravity = -46.37f; // meters per second squared
const bool kPhysicsAllowSleeping = true;
const bool kPhysicsContinuous = true;
const bool kPhysicsUseGhostVertices = false;
const int kPhysicsVelocityIterations = 8;
const int kPhysicsPositionIterations = 1;
const int kDefaultArea = 0;
const int kDefaultLevel = 0;
const int kMaxPlayers = 2;
const int kMaxJumpStrength = 3;
const int kMaxMissileStrength = 3;
const float kPixelScale = 2.0f;
const float kSlowMotionFactor = 0.25f;
const float kSatFactor = 255.0f / 100.0f; // convert 100 max saturation to 255
const Color3B kColorHealth(255, 80, 90);
const Color3B kColorXP(90, 255, 80);
const Color3B kColorGold(255, 255, 0);
const char* const kFont = "font.fnt";
const int kMagicBallMaxOpacity = 164;
const float kLevelTransitionDuration = 0.75f;
const float kDelayBeforeNextLevel = (0.1f * 5.0f); // length of ko anim
const float kLevelObjectNearByDistance = 512.0f; // in points
const bool kLevelAutoSmoothStairs = false;
const bool kLevelAutoSmoothTileCollisions = false;
const float kCharacterDefaultReactionDuration = 0.309f;
const double kCharacterDamageBlinkDuration = 0.618;
const int kCharacterDamageBlinks = 4;
const int kCharacterDamageBlinkOpacity = 128;
const float kItemDelayBeforePickup = 0.5f;
const float kChestOpenDistance = 40.0f;
const char* const kLevelMultiplayer = "Arena.tmx";
const char* const kMultiplayerAppKeyiOS = "6b70009cc9231abbe8faa9c0adb6e5f9";
const char* const kMultiplayerAppKeyAndroid = "d5bef4921508c50f15a616d0dfcb670c";

Tags

Tags allow Cocos2D nodes to be found easily with getChildByTag().

enum
{
	kTagLevelScene = 1100,
	kTagLevel,
	kTagLevelMap,
	kTagLevelObjectLayer,
	kTagPlayer,
	kTagObjectSprite,
	kTagFade
};

XP minimums

This array of experience point minimums are used to determine the level of a player.

const int kXPMinimums[] =
{
	0,
	12, 18, 28, 40, 56, 75, 97, 123, 151, 183,
	217, 255, 296, 340, 387, 437, 491, 547, 606, 669,
	734, 802, 874, 948, 1025, 1105, 1188, 1274, 1363, 1455,
	1549, 1646, 1746, 1849, 1954, 2062, 2173, 2286, 2402, 2521,
};
const int kNumXPMinimums = sizeof(kXPMinimums) / sizeof(kXPMinimums[0]);
const int kMaxXPLevel = kNumXPMinimums - 1;
 
h