Figur mit Mausbewegen
Übersicht

![]() |
ProggerOrkBetreff: Figur mit Mausbewegen |
![]() Antworten mit Zitat ![]() |
---|---|---|
Nabend,
ich habe jetzt noch 2 Probleme die ich einfach net hinkriege-.- Ich habe eine Figur die sich um 360° dreht. Das ist ja noch kein Problem und die Bewegung mit Hilfe von Cos/Sin auch nicht. Nun möchte ich aber so eine Steuerung wie bei "Survivor - Operation Raven Blood verwirklichen. Sprich das die Figur sich nach der Maus dreht... Und wenn ich jetzt schiesse dann bewege ich den Schuss so: Code: [AUSKLAPPEN] B_X = B_X + Cos(B_Winkel) * 2
B_Y = B_Y + Sin(B_Winkel) * 2 Aber ich möchte das der Schuss so schnell fliegt wie in der Variable festgelegt: Speed_Schuss Vlt kann mir ja wer helfen Wäre echt nett:=) bye |
||
konstantin |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Also erstmal würde ich an deiner Stelle ein Array für die Bullets anlegen und dann den Speed so auf ungefähr 40 erhöhen und die Variable Schuss_Speed als globale Variable speichern. | ||
![]() |
ProggerOrk |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hmm ich weiß aber das beantwortet noch nicht ganz meine Frage ![]() Aber trotzdem danke für die Tipps ![]() |
||
![]() |
Mattis_the_brain |
![]() Antworten mit Zitat ![]() |
---|---|---|
Steurungsproblem:
Function winkel#(x1,y1,x2,y2) Return (ATan2(y2-y1,x2-x1)+360)Mod 360 End Function Schussproblem: B_X = B_X + Cos(B_Winkel) * Speed_Schuss B_Y = B_Y + Sin(B_Winkel) * Speed_Schuss |
||
emsee |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
*grml* etwas zu lahm gewesen... hab hier mal ein Beispiel für das Winkelfunktions-Geraffel gecoded *g*
Code: [AUSKLAPPEN] Graphics 640, 480, 16, 2
SetBuffer BackBuffer() Global x_mouse = 0 Global y_mouse = 0 Global pointer_length = 100 Global pointer_x = 640 / 2 Global pointer_y = 480 / 2 Global pointer_x2 = 0 Global pointer_y2 = 0 Global alpha = 0 Function PrintKO() Text 10, 10, x_mouse + " | "+ y_mouse + " | " + alpha + "°" End Function Function PrintPO() Line pointer_x, pointer_y, pointer_x2 + pointer_x, pointer_y2+pointer_y End Function Function Setalpha() Alpha = (ATan2(pointer_y - MouseY(), pointer_x - MouseX())+360) Mod 360: Alpha = Alpha - 180 Pointer_x2 = Cos(alpha) * pointer_length pointer_y2 = Sin(alpha) * pointer_length End Function While Not KeyDown(1) Cls x_mouse = MouseX() y_mouse = MouseY() SetAlpha() PrintKO() PrintPO() Flip() Wend Nix besonderes, zeigt aber wies geht ![]() Bye |
||
![]() |
ProggerOrk |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hmm dank euch:)
So ich werde dann weiter fleißig proggen und wünsche den rest frohe weihnachten;) bye |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group