{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410 {\fonttbl\f0\fswiss\fcharset77 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural \f0\fs24 \cf0 stop();\ /////////////////////\ //DECLARE VARIABLES//\ /////////////////////\ //The velocity vector's x component\ RD.velx = 0;\ //The velocity vector's y component\ RD.vely = 0;\ //Player's maximum velocity\ RD.velmax = 10;\ //The player's facing angle\ RD.ang = 45;\ //The velocity vector's angle\ RD.velang = 0;\ //Force on player\ RD.frc = 0;\ //Player's thrust speed\ RD.spd = .2;\ //The player's turning speed\ RD.turn = 0;\ //Player's maximum turning speed\ RD.maxturn = 10;\ //Player's x velocity modifier\ RD.velxmod;\ //Player's y velocity modifier\ RD.velymod;\ ///////////////\ //MAIN ENGINE//\ ///////////////\ onEnterFrame = function () \{\ //Turn angles from degrees to radians.\ RD.velangr = RD.velang * (Math.PI / 180);\ RD.angr = RD.ang * (Math.PI / 180);\ //Determine new X&Y velocities.\ RD.velxmod = Math.sin(RD.angr) * RD.frc;\ RD.velymod = Math.cos(RD.angr) * RD.frc;\ RD.velx += RD.velxmod;\ RD.vely += RD.velymod;\ if (RD.velx > RD.velmax) \{\ RD.velx = RD.velmax;\ \} else if (RD.velx < -RD.velmax) \{\ RD.velx = -RD.velmax;\ \}\ if (RD.vely > RD.velmax) \{\ RD.vely = RD.velmax;\ \} else if (RD.vely < -RD.velmax) \{\ RD.vely = -RD.velmax;\ \}\ //Determine angle \ RD.velang = Math.atan(RD.velx / RD.vely) * 180 / Math.PI;\ ///////////\ //CONTROL//\ ///////////\ //TURNING\ if (Key.isDown(39)) \{\ if (RD.turn <= RD.maxturn) \{\ RD.turn += .25;\ \}\ \} else if (RD.turn > 0) \{\ RD.turn -= .25;\ \}\ if (Key.isDown(37)) \{\ if (RD.turn >= -RD.maxturn) \{\ RD.turn -= .25;\ \}\ \} else if (RD.turn < 0) \{\ RD.turn += .25;\ \}\ //MOVEMENT// \ RD.ang += RD.turn;\ RD._rotation = RD.ang;\ RD._x += RD.velx;\ RD._y -= RD.vely;\ //THRUST//\ if (Key.isDown(38)) \{\ RD.frc = RD.spd;\ \} else \{\ RD.frc = 0;\ \}\ //LOOPING \ if (RD._x >= 750.1) \{\ RD._x = 0;\ \} else if (RD._x <= -.1) \{\ RD._x = 750;\ \}\ if (RD._y >= 750.1) \{\ RD._y = 0;\ \} else if (RD._y <= -.1) \{\ RD._y = 750;\ \}\ \};}