void WorldManager::update() { count++; if(count % 10 == 0) { ScenePrimitive *shape; shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.02,0.02); shape->setRoll(rand() % 360); shape->setColor(RANDOM_NUMBER, RANDOM_NUMBER, RANDOM_NUMBER, 1.0); shape->setPosition(-0.3 + (RANDOM_NUMBER*0.6), RANDOM_NUMBER); scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false); } }
HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) { core = new POLYCODE_CORE(view, 640,480,false,true,0,0,90,0, true); CoreServices::getInstance()->getResourceManager()->addArchive("Resources/default.pak"); CoreServices::getInstance()->getResourceManager()->addDirResource("default", false); scene = new PhysicsScene2D(0.01, 50); lastEntity = NULL; for(int i=0; i < 50; i++) { ScenePrimitive *shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.1,0.02); shape->setRoll(rand() % 360); shape->setPosition(-0.5 + RANDOM_NUMBER, -0.5 + RANDOM_NUMBER); scene->addCollisionChild(shape, PhysicsScene2DEntity::ENTITY_RECT); } }