4: How To Drag an Object in GameMaker Studio 2 (Pokemon the TCG)

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 50

  • @vagyokvalaki16
    @vagyokvalaki16 10 місяців тому +2

    @byetodd Hi! Your videos help a lot. The drive links in the comments are not working. Could you please send it.

  • @jiru1410
    @jiru1410 Рік тому +4

    Thank you for sharing. I am trying to make your pokemon TCG but I am stuck in scr_init_arrays() because the link you give is broken. Can you please share the scr_init_arrays() codes, Thank you!

  • @howinglhw1212
    @howinglhw1212 Рік тому +2

    😢Hello, I try to make the game, but the cloud drive tells me that your files below the youtube does not exist, can you send me the text version? Please.

  • @yourattentionplease
    @yourattentionplease 3 роки тому

    Hey! I'm really enjoying these videos- thank you so much for making them!
    Can you please explain the steps you took in the Draw Card Info and Init Arrays? I'm trying to make something based off of these codes and I'm running into issues because I don't quite understand why some things are there specifically!
    Thank you!

    • @yourattentionplease
      @yourattentionplease 3 роки тому

      Sorry for the double post- but I figured I may as well give you all the information!
      First off-- I find replaced the temporary variables to add a _ infront of them, just so I could tell them apart. But the error I'm getting is this-
      ```
      trying to index a variable which is not an array
      at gml_Script_scrDrawCardInfo (line 12) - draw_text(10,12*(_i++),nums[_tempNum++]);
      ```
      Thank you for any help!

    • @TMek42
      @TMek42 2 роки тому

      @@yourattentionplease did you change the 'nums' array in the Init Arrays script?

  • @karlvu4449
    @karlvu4449 5 років тому +2

    Can you set the audio volume in your videos higher? Whenever I go to play another video, the sound blasts into my ears through my headset.

    • @byetodd
      @byetodd  5 років тому +2

      Karl Vu I’ll do my best, I am already 18 videos into this series. I will keep this in mind for the next ones.

  • @Prometheus-vt4im
    @Prometheus-vt4im 6 місяців тому

    I noticed that if you place a card on the board where a card is already placed it will destroy the second card and not go back to the deck. Any fix for that?

    • @byetodd
      @byetodd  6 місяців тому

      The field card isn't destroyed, it's modified. The hand card is destroyed. It wouldn't go back into the deck because it's not coded too. The proper action will be addressed later.

  • @challengervale3429
    @challengervale3429 2 роки тому

    forgot to change the x to y in the left release. Took me 2 hours to figure out what was happening.

  • @Jimatron9000
    @Jimatron9000 4 роки тому

    If I'm doing the "scr_init_arrays" part and I want to switch it up a bit and do it without Pokemon, will I need to change the script or is it okay if I just change the "TRAINER" part on the code. Also, how does the engine determine the card numbers if the code we have at scr_init_arrays is mostly notes?

  • @ProjectIcarusFE
    @ProjectIcarusFE 3 місяці тому

    Should probably either put these videos as unlisted and put them in a playlist titled "incomplete card game" or update those Google drive files so that people can actually continue. Sucks to be 4 hours into a project and unable to continue.

    • @byetodd
      @byetodd  3 місяці тому

      You can Google them yourself or grab them from the discord.

  • @Jimatron9000
    @Jimatron9000 4 роки тому +1

    Hi, I really need your help with this one. For some reason, whenever I place 3 to 4 cards in the bench, my game keeps crashing, with any "fatal error" warning. It also crashes instantly when I try to place any card in the "Battlefield" slot. It only happened after I added the code at 22:11. I've been trying to solve it for some time now. If you have any ideas, please, help me out.

    • @byetodd
      @byetodd  4 роки тому

      I have to know what the error is to help you out.

    • @Jimatron9000
      @Jimatron9000 4 роки тому

      @@byetodd Our code is basically the same but for some reason when I open the game and drag my cards into the spaces I've set, the game crashes. No warning, nothing. For some reason if I place them on the bench in a certain order the game won't crash until I place a card on the Battle Field space on the top left. This is really weird but an error doesn't appear, my game just crashes when the card is about to enter the certain spot. I'm trying to see if I can get an error of any sorts to appear right now.

    • @Jimatron9000
      @Jimatron9000 4 роки тому

      @@byetodd Okay, so I tried putting all of the cards in their spots(only in the bench, not the battle field) in a random order, and this time, the game did not crash. But when I tried to draw the remaining 4 cards, this error appeared:
      ############################################################################################
      FATAL ERROR in
      action number 1
      of Mouse Event for Left Released
      for object obj_deck:
      Push :: Execution Error - Variable Index [0,-1] out of range [1,60] - -1.deck(100006,-1)
      at gml_Script_scr_draw (line 9) - hand[handCount] = deck[deckCount];
      ############################################################################################
      --------------------------------------------------------------------------------------------
      stack frame is
      gml_Script_scr_draw (line 9)
      called from - gml_Object_obj_deck_Mouse_7 (line 1) - with(player){scr_draw(1);}

    • @Jimatron9000
      @Jimatron9000 4 роки тому

      @@byetodd I tried the same thing again, but now when my game crashed (in the case where it crashes when I try puttin gall cards on the bench), it actually gave me an error after a few minutes. So this is that error, for the original crashing problem:
      ############################################################################################
      FATAL ERROR in
      action number 1
      of Mouse Event for Left Released
      for object obj_card:
      Memory allocation failed: Attempting to allocate 1048840 bytes
      at gml_Object_obj_card_Mouse_7 (line 15) - sprite_index = sprite;
      ############################################################################################
      --------------------------------------------------------------------------------------------
      stack frame is
      gml_Object_obj_card_Mouse_7 (line 15)
      I'm sorry if I'm a bother, I know it's a lot, but I've been loving this project and I don't wish to quit.
      Thank you for this series and for the help!

    • @byetodd
      @byetodd  4 роки тому

      Jimatron9000 let’s work one issue at a time. Type in the entire error code here.

  • @higus9537
    @higus9537 5 років тому

    the scr_init_arrays() seems a little confusing to me, any reason we're not using 2d arrays for the cards? eg:
    card[0,0] = "Alakazam"
    card[0,1] = spr_alakazam
    etc?

    • @byetodd
      @byetodd  5 років тому

      Hello Sugih, are you recommending we put the strings in one dimension and the integers in the other dimension?
      If this is what you are recommending, i did not do this because, i personally put only one value type per array and also would separate them because there is a disproportional amount of integers per card than there are strings. If i would have used a 2D array, i would want both amounts to be equal.
      I also kept them separate because in the next video we will create get functions in order to pull certain card values and i can use simple code such as "type = strings[(cardNum-1)*10+1];" to do that.
      You also incorporated the sprite designation in your 2D array. I plan on putting sprite designation in their own array since it would be a different value type from strings and integers.

    • @higus9537
      @higus9537 5 років тому

      I was thinking of using using one dimension as card identifier and the other for the string / integer / sprite
      so in future pulling a card value would be
      "name = string[card[cardNum, 1];
      "stage = card[cardNum,2]]];"
      etc
      Now that read your code again I understand how it works, it just looks more complicated to me as beginner

    • @byetodd
      @byetodd  5 років тому

      I am glad you understand it now. I hope my future videos will make it more clear. You will see in the next video that we will create a "get" function that will grab info from these arrays in order to make decisions. Thank you for your input and i hope to hear more from you in the future. Be sure to follow me on twitter if you want a head start on the next video. The next video will be cumbersome due to adding the card sprites. All of the sprites can be found in links on my twitter.

  • @joeyzavala4976
    @joeyzavala4976 4 роки тому

    Hi, would you be able to help me? I'm making a Yu-Gi-Oh cards game which all these videos have been super helpful for. My problem is that a Yu-Gi-Oh filed has two rows, a monster card zone of 5 and a spell/trap zone of 5. I know in a future video you showed a code for being able to play only Pokemon on the field, which I used for monsters. On the upper row. Is there a way to make the bottom row I have for only spell/traps? Thank again! Your videos are awesome! I've been binging them the past three nights to get my game done haha

    • @byetodd
      @byetodd  4 роки тому +1

      Joey Zavala yes, you would do it in the same fashion. Just remove scr_is_pokemon() with scr_is_spell/trap().

    • @joeyzavala4976
      @joeyzavala4976 4 роки тому

      Looks like it works but now my traps and spell are unable to be drawn because the sprite does not exist for them. I'll have to look through and make sure I have all the sprites entered in correctly thanks again!! Love the videos!

    • @byetodd
      @byetodd  4 роки тому +1

      Joey Zavala make sure tour sprite array is set in both your field card and hand card objects

    • @joeyzavala4976
      @joeyzavala4976 4 роки тому

      @@byetodd Thank you! Yes! It's all looking so good now 👊🏼 you rock!

  • @noahmckee4094
    @noahmckee4094 5 років тому

    I made two rows of playable, totaling 12 spaces, but after writing this my game freezeswhenever I play a card onto the second row. I think it has to do with:
    player.handCount--;
    player.hand[hand_position] = 0;
    any advice?
    great videos by the way
    edit: so apparently the game only freezes when I play a card to the right of another card... no idea what's causing this.

    • @Lokosia77
      @Lokosia77 5 років тому

      I got a similar issue, still struggling with it, but when i delete or comment part from >player.hand[hand_position] = 0
      to >instance_destroy();
      it works.
      Looks like there is some kind of infinite loop in player.hand[hand_position] = 0
      , but I did not figure it out yet
      edit: ok looks like we just need to stop looping field positions if we found proper one - I added break; after instance_destroy(); and it works
      any suggestions to improve it?

    • @byetodd
      @byetodd  5 років тому +1

      Noah's issue was that he had a for loop utilizing 'i' inside another for loop that utilizes 'i', this caused an infinite for loop. Where in the video is the code in question? Can you past your code in the comment so I can compare?

    • @Lokosia77
      @Lokosia77 5 років тому +2

      @@byetodd Oh I see, the code is at 26:20 , I tried changing those second for loops [i] to [z] and it works, interesting how it also works with break; :D
      Here is my option with break; just in case joxi.ru/vAWzlGWT1Ywe92.png

    • @slarouche
      @slarouche 2 роки тому

      @@Lokosia77 @ByeTodd Yes, I had the same issue, and changed the for loop variable to "j" instead of using "i" from the first loop (make sense when you look at it), and it fixes the hard loop. Thank you :)

    • @Prometheus-vt4im
      @Prometheus-vt4im 6 місяців тому

      I had the same issue, make sure instance_destroy() is inside the second if we started in the left release event and not at the end on the first if. This fixed it for me