Mausbewegung anhand einer schrägen Linie

Alaniak

Erfahrenes Mitglied
Servus zusammen.

Hab da mal wieder ein kleines Problem.
Und zwar will ich bei einem Pong-Spiel die Paddels nich schlicht hoch und runter bewegen lassen, sondern schräg (z.B. 45°) an einer gedachten Linie.
Die normale Bewegung des Paddels mit Maus hoch und runter ist kein Problem:
Code:
if(_root._ymouse > this._height/2 && _root._ymouse < 450 - this._height/2) this._y = _root._ymouse;

Nur schräg bekomm ich dass irgendwie nich hin. Meine Mathekenntnisse mit sinus und cosinus sind zwar noch ganz ok nur mit der Umsetzung haperts noch ein wenig :)
 
Hi,

Code:
if(_root._ymouse > this._height / 2 && _root._ymouse < 450 - this._height / 2) {
    this._y = _root._ymouse;
    this._x = _root._ymouse;
}
Wäre das dann nicht einfrach so etwas?

Gruß
.
 

Neue Beiträge

Zurück