Skocz do zawartości

Dester

Użytkownicy
  • Postów

    316
  • Dołączył

  • Ostatnia wizyta

  • Wygrane w rankingu

    2

Odpowiedzi opublikowane przez Dester

  1. keyboard_check() jako parametr przyjmuje stałe albo kod ASCII klawisza.

    keyboard_check() jako wartość zwraca boolean true/false w zależności czy klawisz jest teraz wciśnięty czy nie.

     

    I popieram że brak tu logiki. Sprawdzasz warunek, który wykona się tylko gdy warunek wcześniej się wykona, i o ile wcześniejszy się wykona. Zrobiłeś tutaj zagnieżdżony AND a chyba chodziło Ci o OR.

    Ten kod wcześniej działał. Nic nie zmieniłem.

     

    Nowy kod

    GML
    if(reloading==1 or firing==1 or knife==1){

    exit;

    }

     

    if(keyboard_check(0x57)==false and keyboard_check(0x44)==false and keyboard_check(0x53)==false){

     

    walksprite=0;

     

    if(item==""){

    sprite_index=player_idle;

    exit;

    }

    if(item=="rifle"){

    sprite_index=player_rifleidle;

    exit;

    }

    if(item=="pistol"){

    sprite_index=player_pistolidle;

    exit;

    }

    }

    Error at line 6 pos 21: Symbol , or ) expected.

  2. GML
    //RELEASE A

    if(reloading==1 or firing==1 or knife==1){

    exit;

    }

     

    if(keyboard_check(0x57)==0){

    if(keyboard_check(0x44)==0){

    if(keyboard_check(0x53)==0){

     

    walksprite=0;

     

    if(item==""){

    sprite_index=player_idle;

    exit;

    }

    if(item=="rifle"){

    sprite_index=player_rifleidle;

    exit;

    }

    if(item=="pistol"){

    sprite_index=player_pistolidle;

    exit;

    }

    }

    }

    }

    ERROR at line 7 pos 21: Symbol , or ) expected.

    7:

    GML
    if(keyboard_check(0x57)==0){
  3. Jeśli chcesz nadać prędkość stworzonemu obiektowi, to robisz tak

    GML
    var b=instance_create(x,y,obj); //przypisujesz id obiektu do zmiennej tymczasowej

    b.speed=3; //nadajesz predkosc

    b.direction=image_angle; //jak chcesz to i kierunek

    b.jaka_kolwiek_zmienna=0; //i tak mozesz wszystko</span></span>

    Robiłem coś takiego w lua od 2 lat i na to nie wpadłem...

     

    Jak masz kod to można znaleźć w czym jest błąd. Na klockach nie bardzo.

    I tak wiadomo że to wszystko wina gma

    To, że błędy same z siebie się tworzą po otwarciu projektu nie jest normalne

    ...

    Przerobię na kod...

  4. Otwieram projekt w GMS.

    Pojawia się okno.

        
        Error in Object player, Event Key Release A-key, Action 9: Symbol , or ) expected.
        Error in Object player, Event Key Release A-key, Action 11: Symbol , or ) expected.
        Error in Object player, Event Key Release A-key, Action 13: Symbol , or ) expected.
        Error in Object player, Event Key Release D-key, Action 9: Symbol , or ) expected.
        Error in Object player, Event Key Release D-key, Action 11: Symbol , or ) expected.
        Error in Object player, Event Key Release D-key, Action 13: Symbol , or ) expected.
        Error in Object player, Event Key Release S-key, Action 9: Symbol , or ) expected.
        Error in Object player, Event Key Release S-key, Action 11: Symbol , or ) expected.
        Error in Object player, Event Key Release S-key, Action 13: Symbol , or ) expected.
        Error in Object player, Event Key Release W-key, Action 9: Symbol , or ) expected.
        Error in Object player, Event Key Release W-key, Action 11: Symbol , or ) expected.
        Error in Object player, Event Key Release W-key, Action 13: Symbol , or ) expected.

    To są bloczki, i jestem pewien że nie ma w nich żadnych błędów

    Key Release Event for A-key Key:
    
    if reloading is equal to 1
          exit this event
    if firing is equal to 1
          exit this event
    if keyboard_check(0x57) is equal to 0
          if keyboard_check(0x44) is equal to 0
                if keyboard_check(0x53) is equal to 0
                      if knife is equal to 0
                            set variable walksprite to 0
                            if item is equal to ""
                                  set the sprite to player_idle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "pistol"
                                  set the sprite to player_pistolidle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "rifle"
                                  set the sprite to player_rifleidle with subimage 0 and speed 1
                                  exit this event
    Key Release Event for D-key Key:
    
    if reloading is equal to 1
          exit this event
    if firing is equal to 1
          exit this event
    if keyboard_check_pressed(0x41) is equal to 0
          if keyboard_check_pressed(0x57) is equal to 0
                if keyboard_check_pressed(0x53) is equal to 0
                      if knife is equal to 0
                            set variable walksprite to 0
                            if item is equal to ""
                                  set the sprite to player_idle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "pistol"
                                  set the sprite to player_pistolidle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "rifle"
                                  set the sprite to player_rifleidle with subimage 0 and speed 1
                                  exit this event
    Key Release Event for S-key Key:
    
    if reloading is equal to 1
          exit this event
    if firing is equal to 1
          exit this event
    if keyboard_check_pressed(0x41) is equal to 0
          if keyboard_check_pressed(0x57) is equal to 0
                if keyboard_check_pressed(0x44) is equal to 0
                      if knife is equal to 0
                            set variable walksprite to 0
                            if item is equal to ""
                                  set the sprite to player_idle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "pistol"
                                  set the sprite to player_pistolidle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "rifle"
                                  set the sprite to player_rifleidle with subimage 0 and speed 1
                                  exit this event
    Key Release Event for W-key Key:
    
    if reloading is equal to 1
          exit this event
    if firing is equal to 1
          exit this event
    if keyboard_check_pressed(0x41) is equal to 0
          if keyboard_check_pressed(0x44) is equal to 0
                if keyboard_check_pressed(0x53) is equal to 0
                      if knife is equal to 0
                            set variable walksprite to 0
                            if item is equal to ""
                                  set the sprite to player_idle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "pistol"
                                  set the sprite to player_pistolidle with subimage 0 and speed 1
                                  exit this event
                            if item is equal to "rifle"
                                  set the sprite to player_rifleidle with subimage 0 and speed 1
                                  exit this event

×
×
  • Dodaj nową pozycję...