Ir para conteúdo
Fórum Script Brasil

Sir.Lima

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre Sir.Lima

Sir.Lima's Achievements

0

Reputação

  1. Boas, podem-me colocar 2 carros nesse tutorial? Eu já consegui colocar as teclas porém fazendo a cópia das camadas não funciona, alguém me poderá ajudar? Esse código é com as teclas AWSD function step(who) { //check to see if the li in question is controlled by the player1 or by the computer1 if (_root["li"+who].code == "player1") { //we will constantly decrease speed by multiplying it with a number below 1 if (this["speed"+who]>0.3) { this["speed"+who] *= _root.speedDecay; } else { this["speed"+who] = 0; } //the li will react to certain keys //accelerate if (Key.isDown(87) && this["speed"+who]<_root.maxSpeed) { this["speed"+who] += _root.acceleration; } //brake (reverse) if (Key.isDown(83)) { this["speed"+who] -= _root.backSpeed; } //steer left if (Key.isDown(65) && this["speed"+who]>0.3) { _root["li"+who]._rotation -= _root.rotationStep*(this["speed"+who]/_root.maxSpeed); } //steer right if (Key.isDown(68) && this["speed"+who]>0.3) { _root["li"+who]._rotation += _root.rotationStep*(this["speed"+who]/_root.maxSpeed); } this["rotation"+who] = _root["li"+who]._rotation; //we calculate the two components of speed (X axis and Y axis) this["speedx"+who] = Math.sin(this["rotation"+who]*(Math.PI/180))*this["speed"+who]; this["speedy"+who] = Math.cos(this["rotation"+who]*(Math.PI/180))*this["speed"+who]*-1; //apply the components on the actual position of the li _root["li"+who]._x += this["speedx"+who]; _root["li"+who]._y += this["speedy"+who]; //position the shadow of the li _root["shadow"+who]._x = _root["li"+who]._x-4; _root["shadow"+who]._y = _root["li"+who]._y+2; _root["shadow"+who]._rotation = _root["li"+who]._rotation; } if (_root["li"+who].code == "computer1") { } } http://www.emanueleferonato.com/2007/05/15/create-a-flash-racing-game-tutorial/
×
×
  • Criar Novo...