
Quiero crear un juego Flash de Fútbol Soccer, pero no sabría como comenzar, me he planteado varias teorías, y por dónde iniciar. Y creo que comenzaría con el balón, (no se puede jugar si un balón por conclusión

Tendría que darle límites de área, (la cancha de fut, pero ahora solo me importa su física), posX, posY y posZ, junto con sus velocidades y rebotes. Más o menos se me ocurre algo vago...
Código ActionScript :
grav = 0.5; acel = 0.5; fric = 0.75; ball_mc.posX = ball_mc._x; ball_mc.posY = ball_mc._y; ball_mc.posZ = 0; ball_mc.velX = 0; ball_mc.velY = 0; ball_mc.velZ = -10; ball_mc.onEnterFrame = function() { // Datos posX_txt = this.posX; posY_txt = this.posY; posZ_txt = this.posZ; // Velocidades this.velX *= fric; this.velY *= fric; this.velZ += grav // Límite de Gravedad if (this.posZ>=0) this.posZ = 0; if (this._y>this.posY) this.velZ = 0; // Posición this.posX += this.velX; this.posY += this.velY; this.posZ += this.velZ; // Sombra Posiciones sombra_mc._x = this.posX; sombra_mc._y = this.posY; // Movimiento if (Key.isDown(Key.UP)) this.velY -= 5*acel; if (Key.isDown(Key.DOWN)) this.velY += 5*acel; if (Key.isDown(Key.LEFT)) this.velX -= 5*acel; if (Key.isDown(Key.RIGHT)) this.velX += 5*acel; if (Key.isDown(Key.SPACE) and this.velZ == 0) this.velZ -= 10; // En las cordenadas this._x = this.posX; this._y = this.posY+this.posZ; };
posX = Posición X, posY = Posición Y, según el plano cartesiano, y posZ = Altura del balón, sobre el plano cartesiano; las velocidades se manejan igual. Comparten la posición posY con posZ. Y tengo dos símbolos, el balón y su sombra, para ver dónde está según el plano.
Lo que quiero es que rebote el balón, (cuando acabe de caer) y mejorar la caída, (de velZ), pero no consigo hacer un resultado correcto...
¿Alguien podría orientarme o ayudarme con el código?
Posteriormente me gustaría seguir posteando aquí cuando me tope con una duda de mi proyecto y avisarles del avance. Así que tal vez no será el último Post de este tema


Un saludo!