Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 14-11-2006, 02:28   #1 (permalink)
Neuer User
 
Registriert seit: Aug 2006
Beiträge: 368
Question warum bleibt der mc nicht scharf

hallo,

kann mir jemand sagen warum der mc nicht auf "scharfen" koordinaten bleibt?
hab eigentlich alle Math.round positionen durch aber ohne jeglichen erfolg.

ActionScript:
  1. function initSteuerung() {
  2.     with (this.spieler_mc) {
  3.         maxTempo = 20;
  4.         tempoH = 0;
  5.         tempoV = 0;
  6.     }
  7. }
  8. function steuern() {
  9.     with (this.spieler_mc) {
  10.         if (Key.isDown(Key.RIGHT) && tempoH<maxTempo) {
  11.             Math.round(tempoH += 1.0);
  12.         }
  13.         if (Key.isDown(Key.LEFT) && tempoH>-maxTempo) {
  14.             Math.round(tempoH -= 1.0);
  15.         }
  16.         if (Key.isDown(Key.UP) && tempoV>-maxTempo) {
  17.             Math.round(tempoV -= 1.0);
  18.         }
  19.         if (Key.isDown(Key.DOWN) && tempoV<maxTempo) {
  20.             Math.round(tempoV += 1.0);
  21.         }
  22.         _x += tempoH;
  23.         _y += tempoV;
  24.         if (Math.round(tempoH>0.0)) {
  25.             tempoH -= 0.25;
  26.         }
  27.         if (Math.round(tempoH<0.0)) {
  28.             tempoH += 0.25;
  29.         }
  30.         if (Math.round(tempoV>0.0)) {
  31.             tempoV -= 0.25;
  32.         }
  33.         if (Math.round(tempoV<0.0)) {
  34.             tempoV += 0.25;
  35.         }
  36.     }
  37. }
  38. initSteuerung();
  39. this.onEnterFrame = function() {
  40.     steuern();
  41. };


grüße, atlas
Angehängte Dateien
Dateityp: zip fs-ff-key-.zip (2,6 KB, 2x aufgerufen)
atlas ist offline   Mit Zitat antworten
Alt 14-11-2006, 03:23   #2 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
Kein Wunder, Du addierst/subtrahierst ja auch Komma-
werte (0.25) und rundest diese nicht bei der Addition.

Probiers mal so:
PHP-Code:
_x += Math.round(tempoH);
_y += Math.round(tempoV); 
Edit: Hi michael. Auch noch wach?
>Grund: mist zu langsam
War aber knapp!

gruß, gaspode

Geändert von gaspode (14-11-2006 um 03:27 Uhr)
gaspode ist offline   Mit Zitat antworten
Alt 14-11-2006, 03:24   #3 (permalink)
nerdig working
 
Benutzerbild von michael
 
Registriert seit: Jul 2001
Ort: Hamburg
Beiträge: 5.832
PHP-Code:
_x += Math.round(tempoH);
_y += Math.round(tempoV); 

Geändert von michael (14-11-2006 um 03:24 Uhr) Grund: mist zu langsam
michael ist offline   Mit Zitat antworten
Alt 14-11-2006, 03:56   #4 (permalink)
Neuer User
 
Registriert seit: Aug 2006
Beiträge: 368
oh das hab ich ganz übersehen, danke! wird wohl zeit fürs bett!

grüße, atlas
atlas 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 11:21 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele