I'm a student instructed to make a doodle jump replica with ogre3d. I have a function which should make a panel on screen with a designated shape and location so now I wish to make a for loop that will make multiple (up to 10) and a random value that'll set each of them somewhere different on x,y,z.
void PlatformManager::CreatePanelDoodle( float x, float y, float z){
Plane plane3(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane(
"Paddle2", RGN_DEFAULT,
plane3,
20, 5, 20, 20,
true,
1, 5, 5,
Vector3::UNIT_Z);
Entity* groundEntity3 = scnMgr->createEntity("Paddle2");
SceneNode* Paddlenode2 = scnMgr->getRootSceneNode()->createChildSceneNode();
Paddlenode2->setPosition(Ogre::Vector3( x, y, z));
Paddlenode2->attachObject(groundEntity3);
groundEntity3->setCastShadows(false);
}
and this is for attempting to make multiple objects in random space
point plat[20];
float pX;
float pY;
for (int i = 0; i < 10; i++)
{
plat[i].x = rand() % 50;
plat[i].y = rand() % 30;
float pX = plat[i].x;
float pY = plat[i].y;
}
for (int i = 0; i < 10; i++)
{
PlatformManager Panels = new PlatformManager->CreatePanelDoodle(pX, 0, pY);
}
The problem is with the error in the for loop creation "No suitable constructor exists to convert void to "platform manager"
I've tried simply adding the constructor into the for loop, and not using the loop at all. Whats going wrong?
There are some problems in your second code snippet:
float pX;andfloat pY;float pX = plat[i].x;andfloat pY = plat[i].y;newoperator on a void functionYou can solve the problems with