Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 11-04-2004, 17:17   #1 (permalink)
Neuer User
 
Benutzerbild von get-the-flash
 
Registriert seit: Jun 2002
Ort: München
Beiträge: 2.904
gravity / script umbauen

halloOOO

hab das von 2serious.de

ActionScript:
  1. onClipEvent (load) {
  2.     gravity = 15;
  3.     bounce = 0.7;
  4.     radius = _width/2;
  5. }
  6. onClipEvent (mouseDown) {
  7.     if (hitTest(_root._xmouse, _root._ymouse, true)) {
  8.         dragging = true;
  9.         startDrag (this, false, radius, radius, _parent.movwidth-radius, _parent.movheight-radius);
  10.     }
  11. }
  12. onClipEvent (mouseUp) {
  13.     dragging = false;
  14.     stopDrag ();
  15. }
  16. onClipEvent (enterFrame) {
  17.     oldx = x;
  18.     oldy = y;
  19.     x = _x;
  20.     y = _y;
  21.     if (dragging) {
  22.         vx = (x-oldx)*10;
  23.         vy = (y-oldy)*10;
  24.     } else {
  25.         vy += gravity;
  26.         x += (vx/10);
  27.         y += (vy/10);
  28.         if (y<radius) {
  29.             y = radius;
  30.             vx *= bounce;
  31.             vy *= -bounce;
  32.         }
  33.         if (y>(_parent.movheight-radius)) {
  34.             y = _parent.movheight-radius;
  35.             vx *= bounce;
  36.             vy *= -bounce;
  37.         }
  38.         if (x<radius) {
  39.             x = radius;
  40.             vx *= -bounce;
  41.             vy *= bounce;
  42.         }
  43.         if (x>(_parent.movwidth-radius)) {
  44.             x = _parent.movwidth-radius;
  45.             vx *= -bounce;
  46.             vy *= bounce;
  47.         }
  48.         _x = x;
  49.         _y = y;
  50.     }
  51. }

das ist dieses gummbiball beispiel vom johannes.
jetzt will ich aber die drag sachen rausnehmen, was ja an sich kein problem ist.
außerdem will ich aber und jetzt weiss ich nicht weiter, dass der gegenstand (movie) von anfang an auch eine kleinen seitliche bewegung macht.
das muss ja auch schon drin sein im script, weil wenn man den mc bewegt mit der maus, kann man ihn ja auch seitlich schmeissen...

also, wie kann ich das vom start an machen ?

gruss, danke
__________________
---
www.wellenmacher.de
get-the-flash ist offline   Mit Zitat antworten
Alt 12-04-2004, 06:54   #2 (permalink)
Klugscheisser
 
Registriert seit: Jun 2001
Ort: Düsseldorf
Beiträge: 1.354
in den load-ClipEvent schreibst Du z.B.:
ActionScript:
  1. vx=10;//zehn px pro Frame nach rechts
  2.  

P.S.: "vx" schätze ich mal soll "Velocity X" heissen

Geändert von T.Decay (12-04-2004 um 06:55 Uhr)
T.Decay ist offline   Mit Zitat antworten
Alt 12-04-2004, 11:56   #3 (permalink)
Neuer User
 
Benutzerbild von get-the-flash
 
Registriert seit: Jun 2002
Ort: München
Beiträge: 2.904
danke, klappt!
gruss
__________________
---
www.wellenmacher.de
get-the-flash 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 17:19 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele