Source & Demo: rawjet.com/demos/game-mini-ka...
MINI KARTS będzie konwersja gry Mario Karts dla przeglądarek. Dodałem mechanikę poruszania się samochodów po ścieżce złożonej z punktów leżących na torze.
Najtrudniejszym elementem było wyliczenie kąta o jaki ma skręcić samochód, aby dojechał do kolejnego punktu. Najprostszym sposobem było odjęcie wektora (normalnego) kierunkowego auta od wektora kierunkowego punktu docelowego, który obliczyłem przy pomocy arcusa tangens'a drugiego.
Do napisania pozostała fizyka poślizgu (prędkość odśrodkowa), kolizje z elementami trasy, innymi samochodami, a także przepisanie renderowania pod webGL oraz dodanie bonusów, broni i muzyki.
- - -
MINI KARTS will be a conversion of the Mario Karts game for browsers. I added the mechanics of moving cars along a path composed of points on the track.
The most difficult element was calculating the angle at which the car should turn to reach the next point. The simplest way was to subtract the car's (normal) directional vector from the destination point's directional vector, which I calculated using the arctangent of the second.
What remains to be written is the physics of sliding (centrifugal velocity), collisions with track elements and other cars, as well as rewriting the rendering for webGL and adding bonuses, weapons and music.
Негізгі бет Ғылым және технология Mini Karts 0.80 (2D view) - Car Moving - JavaScript © Paweł Drabowicz
Пікірлер: 1