Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Code Snippet Help, Please.

$
0
0
This code is from a simple 3D race car game. When the line : if (I == 400)... is altered the value is for changing a single house near the road in the x direction. I was wondering if someone could tell me how this code works. Mostly, what does line do and what on earth is i about? Are these lines of pixels? EDIT : The screen dimensions are : 1024 x 768 and the world is larger, mainly horizontally. std::vector<Line> lines; for(int i=0;i<1600;i++) { Line line; line.z = i*segL; if (i>300 && i<700) line.curve=0.5; if (i>1100) line.curve=-0.7; if (i<300 && i%20==0) {line.spriteX=-2.5; line.sprite=object[5];} if (i%17==0) {line.spriteX=2.0; line.sprite=object[6];} if (i>300 && i%20==0) {line.spriteX=-0.7; line.sprite=object[4];} if (i>800 && i%20==0) {line.spriteX=-1.2; line.sprite=object[1];} if (i==400) {line.spriteX=-1.2; line.sprite=object[7];} if (i>750) line.y = sin(i/30.0)*1500; lines.push_back(line); } Also, if there is anything else interesting I'd like to here it Thanks so much, Josheir P.S. Is this a beginner's question?

Viewing all articles
Browse latest Browse all 17825

Trending Articles