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?
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 :)
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?
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
@@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.
@@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
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
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...
Straight to the point and functional, I think your channel is going to just keep getting larger and larger!
Thank you :)
Nice tutorial keep up the good work!
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?
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 :)
Good Tutorial :]
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?
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
@@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.
@@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
Could you not put the entire Draw GUI event in one if (!player_exists) statement instead of 3 seperate ones?
Indeed you could! I would definitely be doing that now adays as it would work much better! :D
Thanks for the easy to follow tutorials, 👌🏼
@@scotsparaman No problem sir! Thanks for checking them out :)
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
I'll look into it for the next videos thank you :)
Hey man just wondering how to do custom cursors? So if the player, say, switched guns, then the cursor would also change?
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...
@@scotsparaman hey thanks!! I'll try it out :)
If the max health where to increase, the health bar front would overlap