Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 24-06-2005, 20:11   #1 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Beiträge: 51
vereinfachung bzw. weniger rechenleistung möglich?

einige kennen ja vielleicht mein, "problem" aus dem anderen treat, wie auch immer ich hab eine lösung gefunden, die allerdings sehr rechenaufwendig ist, gibt es vielleicht ne lösung das ganze einfacher bzw. schneller ablaufen zu lassen.
besonders rechenaufwendig ist die "shootout" funktion wenn sie in das "on enter frame" kommt dann hab ich mit glück 1 frame pro sek... und dadruch ist es keine fliesende bewegung mehr was sie egentlich sein sollte...

ActionScript:
  1. function makematrix(nam, posx, posy, x, y, color, depth, color2, field2) {
  2.     _root.createEmptyMovieClip(nam, depth);
  3.     p = 0;
  4.     for (i=1; i<=x; i++) {
  5.         for (j=1; j<=y; j++) {
  6.             if (p == 0) {
  7.                 _root[nam].createEmptyMovieClip("x"+i+"_"+j, p++);
  8.                 with (_root[nam]["x"+i+"_"+j]) {
  9.                     beginFill("0x"+color, 100);
  10.                     lineStyle(0, "0x"+color, 0);
  11.                     lineTo(0, 0);
  12.                     lineTo(5, 0);
  13.                     lineTo(5, 5);
  14.                     lineTo(0, 5);
  15.                     lineTo(0, 0);
  16.                     endFill;
  17.                 }
  18.             } else {
  19.                 _root[nam]["x1_1"].duplicateMovieClip("x"+i+"_"+j, p++);
  20.                 for (h=0; h<field2.length; h++) {
  21.                     if (field2[h] == i || field2[h] == j) {
  22.                         my_color = new Color(_root[nam]["x"+i+"_"+j]);
  23.                         my_color.setRGB("0x"+color2);
  24.                     }
  25.                 }
  26.             }
  27.             with (_root[nam]["x"+i+"_"+j]) {
  28.                 _x = posx+(5*i);
  29.                 _y = posy+(5*j);
  30.             }
  31.         }
  32.     }
  33. }
  34. makematrix("field", 150, 110, 71, 71, "00ff00", 100, "ff00ff", Array(24, 48));
  35. function shootout(nam, sx, sy, ex, ey, speed) {
  36.     counter = 0;
  37.     pr = new Array();
  38.     for (i=sx; i<=ex; i++) {
  39.         for (j=sy; j<=ey; j++) {
  40.             pr.push(i+"_"+j);
  41.         }
  42.     }
  43.     total = pr.length;
  44.     _root.onEnterFrame = function() {
  45.         for (e=0; e<speed; e++) {
  46.             if (counter<total) {
  47.                 r = random(pr.length);
  48.                 _root[nam]["x"+pr[r]]._alpha = 0;
  49.                 pr.splice(r, 1);
  50.                 counter++;
  51.             } else {
  52.                 delete _root.onEnterFrame;
  53.             }
  54.         }
  55.     };
  56. }
  57. start = false;
  58. _root.but.onRollOver = function() {
  59.     trace("Rollover!");
  60.     if (start == false) {
  61.         shootout("field", 24, 24, 71, 71, 73);
  62.     }
  63.     start = true;
  64. };
trebek 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 14:20 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele