bool Level::load(const std::string& filename) { (void)filename; static const b2Vec2 WINDOW_SIZE(WORLD_SIZE.x, WORLD_SIZE.y); static const float PLAYER_SIZE = 20.f; static const float MARGIN = 10.f; static const b2Vec2 INITIAL_PLAYER_POS(3.f * MARGIN, 2.f * MARGIN); static const b2Vec2 GRAVITY(0.f, -100.f); mWorld.reset(new b2World(GRAVITY)); b2AABB platforms[] = { { b2Vec2(MARGIN, MARGIN), b2Vec2(WINDOW_SIZE.x - MARGIN, 2.f * MARGIN) }, { b2Vec2(MARGIN, MARGIN), b2Vec2(2.f * MARGIN, WINDOW_SIZE.y - MARGIN) }, { b2Vec2(WINDOW_SIZE.x - 2.f * MARGIN, MARGIN), b2Vec2(WINDOW_SIZE.x - MARGIN, WINDOW_SIZE.y - MARGIN) }, { b2Vec2(MARGIN, WINDOW_SIZE.y - 2.f * MARGIN), b2Vec2(WINDOW_SIZE.x - MARGIN, WINDOW_SIZE.y - MARGIN) }, { b2Vec2(37.f, MARGIN * 2.f), b2Vec2(37.f + MARGIN, 200.f) }, }; for (size_t i = 0; i < ARRAY_SIZE(platforms); ++i) { addPlatform(platforms[i]); Log << "adding " << platforms[i].lowerBound.x << ", " << platforms[i].lowerBound.y << " -> " << platforms[i].upperBound.x << ", " << platforms[i].upperBound.y << "\n"; } mPlayer.create(mWorld.get(), PLAYER_SIZE, INITIAL_PLAYER_POS); return true; }
void HillsideBattleground::loadPlatforms() { Platform*plat; plat = new Platform(Platform::TYPE_NORMAL, 0,20); plat->addAnimation(new Animation("normal",1,"Images/Game/Stages/HillsideBattleground/plat.png")); plat->changeAnimation("normal", FORWARD); plat->setVisible(false); addPlatform(plat); plat = new Platform(Platform::TYPE_GOTHROUGH, -46.5f, -99.5f, 85, 15); addPlatform(plat); plat = new Platform(Platform::TYPE_GOTHROUGH, -128, -39, 46, 14); addPlatform(plat); plat = new Platform(Platform::TYPE_GOTHROUGH, 75, -39, 46, 14); addPlatform(plat); }
/*********************************************************************** * MapGenerator * genSewersPlatforms ***********************************************************************/ void fired::MapGenerator::genSewersPlatforms() { for (int x = 49; x < 80; x++) addPlatform(x, 30, "bridge.metal"); for (int x = 62; x < 67; x++) addPlatform(x, 40, "bridge.metal"); for (int x = 62; x < 67; x++) addPlatform(x, 45, "bridge.metal"); for (int x = 62; x < 67; x++) addPlatform(x, 50, "bridge.metal"); for (int x = 62; x < 67; x++) addPlatform(x, 55, "bridge.metal"); for (int x = 62; x < 67; x++) addPlatform(x, 60, "bridge.metal"); }
Bar(float width, float height, int platforms) { m_numPlatforms = platforms; addPlatform(); }
/** * used to add a platform's sprite record to the list of sprite records * * @param env required by all java jni * @param obj required by all java jni * @param platform_mapx the x map coordinates of the platform's starting * point. * @param platform_mapy the y map coordinates of the platform's starting * point. */ JNIEXPORT void JNICALL Java_org_davidliebman_android_awesomeguy_Panel_addPlatform(JNIEnv * env, jobject obj, jint platform_mapx, jint platform_mapy) { addPlatform(platform_mapx, platform_mapy); }