Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 21-04-2005, 21:12   #1 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 34
Arrow Spielsteuerung

ActionScript:
  1. // Auto, Obejekt
  2. Spieler = new Object();
  3.  
  4. // Ausgangswerte
  5. Spieler.init = function (clip)
  6. {
  7.     with (clip)
  8.     {
  9.         maxtempo = 10
  10.         tempoH = 0
  11.         tempoV = 0
  12.         }
  13.    
  14.     }
  15. Spieler.steuern = function (clip)
  16. {
  17.     with (clip)
  18.     {
  19.         // 1. Bewegung
  20.         _x += tempoH;
  21.         _y += tempoV
  22.        
  23.         // 2. Beschleunigen
  24.         if (Key.isDown(Key.RIGHT) && tempoH < maxTempo)
  25.         {
  26.             tempoH += 1.0;
  27.             _rotation = 90
  28.             }
  29.         if (Key.isDown(Key.LEFT) && tempoH > -maxTempo)
  30.         {
  31.             tempoH += 1.0
  32.             _rotation = -90
  33.             }
  34.            
  35.         if (Key.isDown(Key.UP) && tempoV > -maxtempo)
  36.         {
  37.             tempoV -= 1.0
  38.             _rotation = 0
  39.             }
  40.         if (Key.isDown(Key.DOWN) && tempoV < maxtempo)
  41.         {
  42.             tempoV += 1.0
  43.             _rotation = 0
  44.             }
  45.         // 3. Diagonal
  46.         if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP))
  47.         {
  48.             _rotation = -45
  49.            
  50.             }
  51.         if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN))
  52.         {
  53.             _rotation = -135
  54.            
  55.             }
  56.         if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN))
  57.         {
  58.             _rotation = 135
  59.            
  60.             }
  61.         if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP))
  62.         {
  63.             _rotation = 45
  64.            
  65.             }
  66.         // 4. Abbremsen
  67.         if (tempoH > 0.0)
  68.         {
  69.             tempoH -= 0.25
  70.             }
  71.         if (tempoH < 0.0)
  72.         {
  73.             tempoH += 0.25
  74.             }
  75.         if (tempoV > 0.0)
  76.         {
  77.             tempoV -= 0.25
  78.             }
  79.         if (tempoV < 0.0)
  80.         {
  81.             tempoV += 0.25
  82.             }
  83.         }
  84.     }
  85. Spieler.init;
  86. this.Spieler.onEnterFrame = function ()
  87. {
  88.     Spieler.steuern
  89.     }

was ist falsch? ich hab das in nem frame programmiet, und dann auf einen mc zugegriffen, was ist da der fehler?
Hawke ist offline   Mit Zitat antworten
Alt 21-04-2005, 21:32   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Hast du das Spieler-Objekt nicht mit dem MC über Object.registerClass verbunden? BTW: dieser Thread wäre im OOP-Board wohl besser aufgehoben...
  Mit Zitat antworten
Alt 22-04-2005, 15:47   #3 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 34
danke... das wars zwar nicht, aber ich hab es ein bisschen anders gemacht, funkt jetzt!
Hawke ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 10:04 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele