开发者

How to create isometry imitation in 2d Racing game?

开发者 https://www.devze.com 2023-01-06 16:16 出处:网络
How can I modify 2d racing game to seem like isometry? Flash + ActionScript3 ScreeShot The game is totally in 2d. Car moves like it should and while it drives the ground everything is fine.

How can I modify 2d racing game to seem like isometry? Flash + ActionScript3

ScreeShot

The game is totally in 2d. Car moves like it should and while it drives the ground everything is fine. I've added a grey ramp. Now the car should move like the arrows are showing, creating illusion of a 3d (iso开发者_Go百科metry).

Ramp is divided in 3 sectors

-first,sector to the right (where the car is currently situated);

-second,sector to the left;

-third, sector on top;

Plus I need the car,to jump out from the ramp when the speed is high. I reffer to old scholl game Rock'n'Roll Racing (Blizzard's game for Sega)

So the questions are

1) How should I change car's angle and velocities(velocityX and velocityY) when driving on the ramp ?

2) How can I initiate jumping out of the ramp? For example like in Rock'n'Roll racing? or how Blizzards essentially did it? (maybe suggestions)

Thaks.


The best is to calculate the game in 3D and then simply project it into isometry.

const angle:Number = Math.PI/3;//you may want to tweak this one
const xVec:Point = Point.polar(-Math.PI/2 + angle, 1);
const yVec:Point = Point.polar(-Math.PI/2 - angle, 1);
const zVec:Point = new Point(0, -1);

transform 3D to 2D:

function transform(x:Number, y:Number, z:Number):Point {
     return new Point(x*xVec.x + y*yVec.x + z*zVec.x, x*xVec.y + y*yVec.y + z*zVec.y);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消