Guten Abend,
ich hab (glaube ich ^^) ein kleines Problem mit meinen Globalen Variablen.
Ich hab ein Tutorial für einen AnalogStick gemacht und nun versuche ich damit ein Objekt zu bewegen.
So sieht der Code aus um direct zu definieren:
Alles anzeigen
und so rufe ich das ganze in meiner Timeline ab:
der error ist:
Habe es leider noch nicht geschafft mein Problem zu lösen, weshalb ich nun euch befrage
ich hab (glaube ich ^^) ein kleines Problem mit meinen Globalen Variablen.
Ich hab ein Tutorial für einen AnalogStick gemacht und nun versuche ich damit ein Objekt zu bewegen.
So sieht der Code aus um direct zu definieren:
GML-Quellcode
- var a,b,c,d;
- a = view_xview[0]; //Left side of the screen
- b = view_yview[0]; //Top side of the screen
- c = view_xview[0] + view_wview[0]; //Right side of the screen
- d = view_yview[0] + view_hview[0]; //Bottom side of the screen
- var pad_x,pad_y,pad_radius,stick_radius;
- pad_x = 100 ; //Modify x and y to where ever on the screen. This is the pad co-ordinates from the center of the circle
- pad_y = 500 ;
- pad_radius = 40; //Radius of the pad thing
- stick_radius = 14; //Radius of the stick
- draw_sprite(Circle_Pad_Spr,0,pad_x,pad_y);
- var stick_x,stick_y;
- stick_x = pad_x; //This is the stick co-ordinates from the center of the dot
- stick_y = pad_y;
- if (stick_active) //If the stick is active, it allows the blue dot (stick) to move around the red circle (pad)
- {
- stick_x = Mouse_Input_Script(4,pad_x,pad_y,pad_radius - stick_radius);
- stick_y = Mouse_Input_Script(5,pad_x,pad_y,pad_radius - stick_radius);
- }
- draw_sprite(Circle_Stick_Spr,0,stick_x,stick_y);
- if (stick_active)
- {
- var angle,direct,str;
- angle = Angle_Script(1,pad_x,pad_y,mouse_x,mouse_y); //This retrieves the degree angle fro mthe pad to the mouse <-A MUST
- direct = 1 + (5 * (n_way == 2)); //Defaulting to DOWN
- direct = Angle_Script(5,angle);
- }
- globalvar direct;
und so rufe ich das ganze in meiner Timeline ab:
der error ist:
GML-Quellcode
- ___________________________________________
- FATAL ERROR in
- action number 1
- at time step5
- of time line timeline0:
- ############################################################################################
- VMError!! Occurred - Push :: Execution Error - Variable Get -5.direct(100030, 0)
- at Timeline_timeline0_0 (line 2) - if(direct == 2)
- ############################################################################################
Habe es leider noch nicht geschafft mein Problem zu lösen, weshalb ich nun euch befrage
