Flash End-of-Life, Ruffle Integration!
This game runs on Adobe Flash. Effective Jan. 2021, Adobe began blocking its flash player's use everywhere. Kongregate is now partnering with Ruffle to make some of our Flash content playable again. Please note: If you are using Ruffle, badges will not work normally. In order to earn a badge in a Flash game, you will need to complete the badge, then submit a screenshot (showing both proof of completion and your username) as a missing badge report using the report missing achievement option. Also, please join us in the Kongregate Discord for all the latest Kongregate news!
Example 2 - Including Rotation and Acceleration
開發者 SnipingMayhem
Example 2 - Including Rotation and Acceleration
Example 2 - Including Rotation and Acceleration 的標籤
遊戲簡介
This is my second example using 45 lines of code. As you can tell the coding is a lot more advanced and includes rotation and friction.
Thanks people and send me money . Ill use it wisely :)
After comments im including the code i put on the car to enable the movement
onClipEvent(load){
var speed = 0;
}
onClipEvent (enterFrame) {
if(Key.isDown(Key.UP)){
speed += 1.5;
}
if (Key.isDown (Key.RIGHT)) {
if (speed < 5 && speed >= 0) {
_rotation += 2 * speed;
} if (speed < 0) {
_rotation += 7.5 * speed / 15;
} else {
_rotation += 7.5;
}
speed *= 0.95;
}
if(Key.isDown(Key.LEFT)){
if (speed < 5 && speed >= 0) {
_rotation -= 2 * speed;
} if (speed < 0) {
_rotation -= 7.5 * speed / 15;
} else {
_rotation -= 7.5;
}
speed *= 0.95;
}
if(Key.isDown(Key.DOWN)){
speed -= 0.8;
}
speed = speed * 0.98;
_x += Math.sin (_rotation * Math.PI / 180) * speed;
_y += Math.cos (_rotation * Math.PI / 180) * -speed;
if (Math.abs (speed) > 20) {
speed = 20;
}
if (speed < -10) {
speed = -10;
}
if (Key.isDown (Key.CONTROL)) {
speed -= speed / 10;
}
}
Enjoy.
玩法說明
Up, Down, Left, Right
留言
vervoutaim
Jan. 04, 2009
hey, my car drove of the screen and it won't return?
Stormgate
Apr. 15, 2016
I like this game ...and the first time my car wasn't returning, but at my second try, I just didn't accelerated that fast & it was also returning back to me :-)
Heylon
Sep. 06, 2009
Wow really is this stolen? shame.
Yoh0Asakura
Mar. 25, 2009
It's a joke??
Shot!
Lucifer145
Feb. 19, 2009
you know, this is useless, if you give a code to copy and dont explain it it's just creating noob developers
and yeah, the physics sucks, copying some trigonometry won't make you a better developer...