I just started learning C++ and SFML, and I'm writing game like doodle jump. I have three different platforms. My platforms are set randomly but... overlapped. Here's a screenshot. ---> 1
Here's part of my code. Plese by patient.
int main()
{
srand(time(NULL));
RenderWindow app(VideoMode(600, 600), "Doodle Game!");
app.setFramerateLimit(60);
Texture t1,t2,t3,t4,t5;
t1.loadFromFile("4.png");
t2.loadFromFile("platform.png");
t3.loadFromFile("cartoon.png");
t4.loadFromFile("rock.png");
t5.loadFromFile("wood.png");
Sprite sBackground(t1), sPlat(t2), sPlat1(t4), sPlat2(t5), sPers(t3);
sPers.setScale(0.3f, 0.3f);
sPlat.setScale(0.06f, 0.06f);
sPlat1.setScale(0.06f, 0.06f);
sPlat2.setScale(0.06f, 0.06f);
point plat[20];
point plat1[20];
point plat2[20];
for (int i=0;i<10;i++)
{
plat[i].x=rand()%600;
plat[i].y=rand()%600;
plat1[i].x=rand()%600;
plat1[i].y=rand()%600;
plat2[i].x=rand()%600;
plat2[i].y=rand()%600;
}
Aucun commentaire:
Enregistrer un commentaire