このサイズに決定しました。こんな感じで描画されます。
http://hirohirosystem.com/003_cargame/cargameSV061.html
誰かバグを見つけて。つぃまで。
・コーデイング
stszy = parseInt(INTSECDATA[3].substr(6,3)) - 90;
stszx = parseInt(INTSECDATA[3].substr(2,3)) + 90*600/800;
function ib_draw(){
背景の描画
if(intbl[3].tszy > stszy-60){
sj = 10 + wj;
wj = 0;
for(j=sj; j>7; j--){
scale = 600/(2*(800-stszy + 120 - (sj -j)*30));
if((stszy + (sj - j)*30)<intbl[1].tszy - 15){
draw_obj(img_gobj[j], stszx + 60 - (sj-j)*30*600/800, stszy + (sj-j)*30, scale);
wj = wj + 1;
}
}
}
交差点の描画
for(j=0; j<14; j++){
scale = 600/(2*(800-intbl[3].tszy + 120 - j*30));
if((intbl[3].tszy + j*30)<800){
draw_obj(img_gobj[j], intbl[3].tszx + 60 - j*30*600/800, intbl[3].tszy + j*30, scale);
}
}
}
修正
var wj = 1;
var sj = 10;
var svj = 0;
var stszx = 100;
var stszy = 10;
stszy = parseInt(INTSECDATA[3].substr(6,3)) - 90;
stszx = parseInt(INTSECDATA[3].substr(2,3)) + 90*600/800;
function lu_draw(){
if(intbl[3].tszy > stszy-60){
sj = 18 + wj;
sdj = 18 - Math.ceil(wj);
//wj = 0;
for(j=sdj; j<=18; j++){
shj = j - sdj;
// shj = sj - j;
scale = 600/(2*(1 + 800-stszy + 120 - shj*30));
if((stszy + shj*30)<intbl[1].tszy - 15){
if(j <= 18){
draw_obj(img_gobj[j], stszx + 60 - shj*30*600/800, stszy + shj*30, scale);
//wj = wj + 1;
}
}
}
wj = wj + 0.1;
}
}
・修正2(滑らか描画)
リンクをつけときました。
http://hirohirosystem.com/003_cargame/cargameSV061.html
INTSECDATA = [
"1,420,090,150,20,010,7,13",
"2,560,100,010,20,020,7,13",
"3,400,100,010,20,020,7,13",
"4,400,120,200,25,025,7,13"
];
ib_draw();
ib_next();
ib_keisan();
gameover1 += 1
if(intbl[0].tszy<400){
setTimeout("mmain()", sec_time*10);
}
:
:
function ib_keisan(){
for(i=0; i<4; i++){
//"1,300,240,400,20,040,7,13",
//"2,740,340,100,20,200,7,13",
//"3,160,340,100,20,200,7,13",
cid = intbl[i].tcid;
szx = intbl[i].tszx;
szy = intbl[i].tszy;
kuw = intbl[i].tkuw;
hlw = intbl[i].thlw;
hw = intbl[i].thw;
hlsu1 = intbl[i].thlsu1;
hlsu2 = intbl[i].thlsu2;
if((cid === "1")||(cid === "4")){
cnline = parseInt(szx+kuw/2);
yow = parseInt((kuw-parseInt(kuw/hlsu2)*hlsu2)/2);
hkuw = parseInt(kuw/hlsu2);
cnsu = Math.round(hlsu1/2)-1;
ulx = szx + yow;
uly = szy;
urx = ulx + hkuw;
ury = uly;
shkuw = hw*0.8/(hlsu2+1)*2;
drx = parseInt(urx - hw*0.83 +shkuw);
dry = ury + hw;
dlx = parseInt(ulx - hw*0.83);
dly = dry;
ib_xy[i][0][0*2] = ulx;
ib_xy[i][0][0*2+1] = uly;
ib_xy[i][0][1*2] = urx;
ib_xy[i][0][1*2+1] = ury;
ib_xy[i][0][2*2] = drx;
ib_xy[i][0][2*2+1] = dry;
ib_xy[i][0][3*2] = dlx;
ib_xy[i][0][3*2+1] = dly;
for(j=1;j<JSU;j++){
ulx = urx + hkuw;
uly = szy;
urx = ulx + hkuw;
ury = uly;
if(j < cnsu){
dlx = parseInt(ulx - hw*0.83 + shkuw + shkuw*j);
}else{
if(j === cnsu){
//dlx = parseInt(ulx - shkuw*(j-1));
dlx = parseInt(ulx - shkuw*(j-2));
}else{
//dlx = parseInt(ulx + hw*0.8 - shkuw*(5-j) - shkuw*(8-j));
dlx = parseInt(ulx + hw*0.83 - shkuw*(hlsu2-2*j));
//dlx = parseInt(ulx + hw*0.8 + shkuw*((3-j)-6));
if(j === hlsu1-1){
dlx = ulx +hw*0.83 -shkuw;
}
}
}
dly = uly + hw;
if(j < cnsu){
drx = parseInt(dlx + hkuw + shkuw*j);
}else{
if(j===cnsu){
//drx = parseInt(urx + shkuw*(j-1));
drx = parseInt(urx + shkuw*(j-2));
}else{
drx = parseInt(dlx + hkuw + shkuw*(hlsu1-1-j));
if(j===hlsu1-1){
drx = urx + hw*0.83;
}
}
}
dry = dly;
ib_xy[i][j][0*2] = ulx;
ib_xy[i][j][0*2+1] = uly;
ib_xy[i][j][1*2] = urx;
ib_xy[i][j][1*2+1] = ury;
ib_xy[i][j][2*2] = drx;
ib_xy[i][j][2*2+1] = dry;
ib_xy[i][j][3*2] = dlx;
ib_xy[i][j][3*2+1] = dly;
}
}
if((cid === "2") || (cid === "3")){
//余白を求める
yow = parseInt((hw-parseInt(hw/hlsu2)*hlsu2)/2);
hkuw = hw*0.3/hlsu2;
ahkuw =hw*0.4/hlsu2;
ulx = szx;
uly = szy + yow;
urx = ulx + kuw;
ury = uly;
hhw = parseInt(hw/hlsu2);
ahhw = hw/hlsu2;
if(cid === "2"){
//drx = parseInt(urx + hhw*0.83) + (dry-szy-yow)*0.3;
drx = parseInt(urx + ahhw*0.83 + ahkuw);
}else{
drx = parseInt(urx - hhw*0.8);
}
dry = ury + hhw;
if(cid === "2"){
//dlx = parseInt(ulx + hhw*0.83) + (dry-szy-yow)*0.3;
dlx = parseInt(ulx + ahhw*0.83);
}else{
//dlx = parseInt(ulx - hhw*0.83) - (dry-szy-yow)*0.3;
dlx = parseInt(ulx - hhw*0.8 - hkuw);
}
dly = dry;
ib_xy[i][0][0*2] = ulx;
ib_xy[i][0][0*2+1] = uly;
ib_xy[i][0][1*2] = urx;
ib_xy[i][0][1*2+1] = ury;
ib_xy[i][0][2*2] = drx;
ib_xy[i][0][2*2+1] = dry;
ib_xy[i][0][3*2] = dlx;
ib_xy[i][0][3*2+1] = dly;
for(j=1;j<JSU;j++){
uly = dly + hhw;
if(cid === "2"){
//@@@@@@@
ulx = parseInt(dlx + ahhw*0.9);
//ulx = parseInt(dlx + hkuw);
}else{
//ulx = parseInt(dlx - hhw*0.83) - (uly-szy-yow)*0.3;
ulx = parseInt(dlx - hhw*0.8 - hkuw);
}
urx = ulx + kuw;
if(cid === "2"){
//urx = parseInt(drx + hhw*0.8) + (uly-szy-yow)*0.3;
urx = parseInt(drx + ahhw*0.9 + ahkuw);
}else{
urx = parseInt(drx - hhw*0.8);
}
ury = uly;
if(cid === "2"){
//drx = parseInt(urx + hhw*0.8) + (dry-szy-yow)*0.3;
drx = parseInt(urx + ahhw*0.9 + ahkuw);
}else{
drx = parseInt(urx - hhw*0.8);
}
dry = uly + hhw;
if(cid === "2"){
dlx = parseInt(ulx + ahhw*0.9);
}else{
//dlx = parseInt(ulx - hhw*0.8) - (dry-szy-yow)*0.3;
dlx = parseInt(ulx - hhw*0.8 - hkuw);
}
dly = dry;
ib_xy[i][j][0*2] = ulx;
ib_xy[i][j][0*2+1] = uly;
ib_xy[i][j][1*2] = urx;
ib_xy[i][j][1*2+1] = ury;
ib_xy[i][j][2*2] = drx;
ib_xy[i][j][2*2+1] = dry;
ib_xy[i][j][3*2] = dlx;
ib_xy[i][j][3*2+1] = dly;
}
}
}
}
function ib_next(){
intbl[0].tcid = intbl[0].tcid;
intbl[0].tszx = intbl[0].tszx - tspd*20/30;
intbl[0].tszy = intbl[0].tszy + tspd;
intbl[0].tkuw = intbl[0].tkuw + tspd*20*2/30;
intbl[0].thlw = intbl[0].thlw;
intbl[0].thw = intbl[0].thw + tspd*5/30;
intbl[0].thlsu1 = intbl[0].thlsu1;
intbl[0].thlsu2 = intbl[0].thlsu2;
intbl[0].tthhw = intbl[0].tthhw + tspd;
intbl[3].tcid = intbl[3].tcid;
intbl[3].tszx = intbl[0].tszx - intbl[0].tthhw*20/30;
intbl[3].tszy = intbl[0].tszy + intbl[0].tthhw;
intbl[3].tkuw = intbl[0].tkuw + intbl[0].tthhw*20*2/30;
intbl[3].thlw = intbl[3].thlw;
intbl[3].thw = intbl[3].thw + tspd*2*5/30;
intbl[3].thlsu1 = intbl[3].thlsu1;
intbl[3].thlsu2 = intbl[3].thlsu2;
intbl[1].tcid = intbl[1].tcid;
intbl[1].tszx = intbl[0].tszx + intbl[0].tkuw + intbl[0].thw*1;
intbl[1].tszy = intbl[0].tszy + intbl[0].thw*1;
intbl[1].tkuw = intbl[1].tkuw + tspd*5/30;
intbl[1].thlw = intbl[1].thlw;
intbl[1].thw = intbl[3].tszy - intbl[0].tszy - intbl[0].thw;
intbl[1].thlsu1 = intbl[1].thlsu1;
intbl[1].thlsu2 = intbl[1].thlsu2;
intbl[2].tcid = intbl[2].tcid;
intbl[2].tszx = intbl[0].tszx - intbl[0].thw*1 - intbl[1].tkuw;
intbl[2].tszy = intbl[0].tszy + intbl[0].thw*1;
intbl[2].tkuw = intbl[1].tkuw;
intbl[2].thlw = intbl[2].thlw;
intbl[2].thw = intbl[1].thw;
intbl[2].thlsu1 = intbl[1].thlsu1;
intbl[2].thlsu2 = intbl[1].thlsu2;
intbl[0].tthhw = intbl[3].tszy - intbl[0].tszy;
intbl[3].tthhw = intbl[0].tszy - intbl[3].tszy;
intbl[1].tthhw = intbl[1].szx - intbl[2].szx;
intbl[2].tthhw = intbl[2].szx - intbl[1].szx;
}
1)2次元描画の完成。
・丸目、円、パイプ
・バイク、服
オペレーション
・マウスの活用。
2)ロボット
・服
3)カーレース
・バイク
・背景
丸め。
バイクの構造の部品を
物体を四角、台形、逆台形、円、球等で分け、
組合せで図形を構成する。
6面の2Dで表現し、段等の区別は色で分ける。
普通のバイクから描画しようかな。
点と(x、y、z)のベクトル。
通常
四角形の立体(立方体)は、8の点で出来ている。
ベクトル(x、y、z)で表現すると。
1点の座標とベクトルで立体の表示は表せれる。