Hi to all! i’m creating a game with implemented box2D, and i want to create a dynamic ramdomized terrain like this :
how i have to do for texturize my point in a way like that in photos?
if you can a piece of code is apreciated XD
Hi to all! i’m creating a game with implemented box2D, and i want to create a dynamic ramdomized terrain like this :
how i have to do for texturize my point in a way like that in photos?
if you can a piece of code is apreciated XD
Use quads, or increase the texture coords every 2 rectangles (like you are doing in the image).
Besides that, just draw them normally.
I try and tell you if i do it right XD
no, i’m not able to do this
i have this code :
for(int i=0; i<colline; i++) {
if(i != 0) {
randomHeight = (float)Math.random()*hard;
HillHeight -=randomHeight;
}
for(int j=0; j<HillSlices; j++) {
// Creo la posizione del punto del terreno
vertici.add(new Vector2(j*distance+HillWidth*i, (float)(HillHeight+randomHeight*Math.cos(2*Math.PI/HillSlices*j))));
}
HillHeight += randomHeight;
}
vertici il my array with all the points, but i really don’t know how to drow it in the rendere() with the texture, can somebody teach me how to do this?
for(int i=0; i<colline; i++) {
HillHeight -=randomHeight;
nexthillheight = HillHeight - randomHeight2;
corner_leftup = Vector2(HillWidth*i, HillHeight);
corner_rightup = Vector2(HillWidth*(i+1), nexthillheight);
corner_leftdown = Vector2(HillWidth*i, HillHeight+Height);
corner_rightdown = Vector2(HillWidth*(i+1), nexthillheight+Height);
}
Draw using gl_triangles
Set texture coords accordingly (dont know how this is done in libgdx).