GameMaker: Studio Tutorial - HUD Bars

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии •

  • @Fairlii
    @Fairlii 6 лет назад +6

    Straight to the point and functional, I think your channel is going to just keep getting larger and larger!

    • @GMGuru
      @GMGuru  6 лет назад

      Thank you :)

  • @braxtonsdev9564
    @braxtonsdev9564 6 лет назад +1

    Nice tutorial keep up the good work!

  • @slickygreasegames
    @slickygreasegames 3 года назад +1

    This is a fantastic tutorial, simple and straight to the point. But I got a question. I was wondering for the stamina meter you could do something else to it? Like, I want the meter to drain, but when you collect something (like an item), the meter will gain some of its stamina back. What would be your approach?

    • @GMGuru
      @GMGuru  3 года назад

      Thank you! I'd probably just have it where when you collide with the item it would do
      global.stamina += 25 (or whatever value you wanted)
      then
      instance_destroy()
      to then destroy the item so you only get the stamina once instead of multiple times :)

  • @jalep5019
    @jalep5019 2 года назад

    Good Tutorial :]

  • @HoffayStudios35
    @HoffayStudios35 4 года назад +1

    Suppose you're doing this with health but in a Zelda-esque design, where there're single instances representing an amount of the player's health. How would you set it to draw the correct amount of Health boxes (Or hearts for the sake of simplicity) to equal the player's maximum health?

    • @GMGuru
      @GMGuru  4 года назад +2

      Let's say we have 4 heart's. I'd make it where global.maxhealth = 4;
      Every time you take damage remove one of the instances. If your doing half hearts just double the amount and when it takes away change the sprite index.
      I have done this before but I used a whole sprite sheet of hearts with half containers & did it that way. Hope what I said above is helpful

    • @HoffayStudios35
      @HoffayStudios35 4 года назад

      ​@@GMGuru I did try that, but I'm having complications since I made my system more intricate than that
      Each "heart" represents 10 HP in my game, with half "hearts" for every 5 HP.
      Because of the HP being a numerical value represented by halves of a sprite, I've had to create two extra variables to handle this. However, it doesn't seem to be working, as the obj_hud runs through the if statement (which contains two more if statements handling the positioning of each new "heart"), and it seems that it only creates two out of 5 maximum I run the game. If there's any place I can message you the code for you to look at, I can do that.

    • @GMGuru
      @GMGuru  4 года назад +2

      @@HoffayStudios35 If you join my discord (linked below the video) and then you thumbs up the rules then post it in the help channel I'll try my best :D

  • @scotsparaman
    @scotsparaman 4 года назад +1

    Could you not put the entire Draw GUI event in one if (!player_exists) statement instead of 3 seperate ones?

    • @GMGuru
      @GMGuru  4 года назад +1

      Indeed you could! I would definitely be doing that now adays as it would work much better! :D

    • @scotsparaman
      @scotsparaman 4 года назад +1

      Thanks for the easy to follow tutorials, 👌🏼

    • @GMGuru
      @GMGuru  4 года назад

      @@scotsparaman No problem sir! Thanks for checking them out :)

  • @ZayyzYT
    @ZayyzYT 6 лет назад

    i like how short your videos are compared to other youtubers
    maybe try hiding your taskbar
    its pretty easy to do.
    go to windows settings and search taskbar
    and find taskbar settings
    when your in the taskbar settings click on "Automatically hide the taskbar in desktop mode"
    now when you hover over the bottom of your screen the taskbar will pop up
    this will make your videos much more clean

    • @GMGuru
      @GMGuru  6 лет назад

      I'll look into it for the next videos thank you :)

  • @8urrow172
    @8urrow172 4 года назад

    Hey man just wondering how to do custom cursors? So if the player, say, switched guns, then the cursor would also change?

    • @scotsparaman
      @scotsparaman 4 года назад

      There is a built in function, “cursor_sprite”... you could use an if statement, put it in the step event of a controller object or a custom function:
      if (weapon1) {
      cursor_sprite = sprCursor1;
      } else if (weapon2) {
      cursor_sprite = sprCursor2;
      } else if (noWeapon) {
      cursor_sprite = sprDefaultCursor;
      }
      Or you could use an Enumeration style state machine (probably preferred) and have something like...
      ----------------------------------------------------------------------------
      PLAYER CREATE EVENT:
      window_set_cursor(cr_none);
      enum CURSOR {

      weap1,
      weap2,
      defaultCur
      // Cursor when unarmed if needed

      }
      cursorState = CURSOR.defaultCur;
      ----------------------------------------------------------------------------
      COLLISION EVENT WITH WEAPON1:
      cursorState = CURSOR.weap1;
      ----------------------------------------------------------------------------
      COLLISION EVENT WITH WEAPON2:
      cursorState = CURSOR.weap2;
      ----------------------------------------------------------------------------
      PLAYER STEP EVENT:
      switch cursorState {
      case CURSOR.defaultCur:
      cursor_sprite = sprCursorDefault;
      break;

      case CURSOR.weap1:
      cursor_sprite = sprCursor1;
      break;

      case CURSOR.weap2:
      cursor_sprite = sprCursor2;
      break;
      }
      ----------------------------------------------------------------------------
      if you don't need a default cursor, ie player will never be unarmed, remove the case from switch statement and enum else if they will be unarmed add code to the weapon objects destroy event to change the cursorState = CURSOR.defaultCur;
      Probably better ways to do it, im relatively new to it...

    • @8urrow172
      @8urrow172 4 года назад +2

      @@scotsparaman hey thanks!! I'll try it out :)

  • @Robin-lg6mz
    @Robin-lg6mz 3 года назад

    If the max health where to increase, the health bar front would overlap