Annonces
Annonces

Envoyer ce jeu à un ami
Votre nom *
Votre email *
Email de votre ami *
Votre message


(* : Champs obligatoires)


Voter pour ce jeu
Note moyenne : 0.0 / 0 votes.
Jeu Example 2 - Including Rotation and Acceleration

Example 2 - Including Rotation and Acceleration

This gaming website is available in: English.

Description du jeu "Example 2 - Including Rotation and Acceleration" :
Voici mon deuxième exemple utilisant 45 lignes de code. Comme vous pouvez le constater, le code est beaucoup plus avancé et inclut la rotation et la friction.

Merci à tous et envoyez-moi de l'argent. Je l'utiliserai à bon escient :)

Après les commentaires, j'inclus le code que j'ai mis sur la voiture pour activer le mouvement

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;
}
}

Amusez-vous bien.

Jeux similaires à "Example 2 - Including Rotation and Acceleration" :
Annonces
Code HTML pour insérer ce jeu sur votre Blog / Site (personnaliser la taille)