The 'elaborating' style (if that's what you mean with 'before') helped me a lot to gain a firm understanding of what is going on, but if it's not about basic concepts but about how to get it done, this style is also fine.
These videos have helped me create: - multiple player inventories - unlimited chest inventories - drag and drop items between inventories - quick add between inventories - add all from chest to player based on space available - JSON save/load system to store all of the information Thanks so much Shaun. My next goals are: - stacking - sorting by type
I feel like scripts like "remove" "add" "search" and such are such a no brainer but for the longest time I struggled to conceptualize it. Great tutorial, Shaun!
When I first saw this video, I didn't quite understand it and just copied the code and checked the results. After a year, I started to gradually understand what this video was talking about after making a few prot types. The example of fitting the last combat ship inspired me. (I was abandoned for an attractive inventory system.) Thank you!
Wow I'm currently trying to create an inventory system but haven't found a good one yet, I've watched your old tutorials but I feel lost not knowing which method to use, thanks for uploading this video!
Very good tutorial, so much information and practical coding in such a short timeframe. Some suggestions for continuing this series; - Make a special row of slots for quick access, something like the one used in minecraft. - When using an item or deleting from the list start from the back, so the inventory keeps it's filled slots to the top and front of the list. - Make a few extra icons inside the inventory window, one for dropping an item and one for destroying an item to drag the items to with mouse. - Make a split screen inventory for multi player and merchant type interactions. To the left the person you're interacting with and to the right your own inventory. With some action icons for offering items and accepting the offer of the other person.
Don't be dumb like me: meticulously rechecking the code multiple times, wondering why nothing is happening when running the project, only to realize I forgot to put the inventory object in the starting room.
I often use a controller object, mostly build in into a menu controller.. this object is the only thing I place into the room, the controller creates the other instances to be placed in the room so I can see what is needed and where, and can easily add or remove in this list.
I was about to tell a whole paragraph on why you should make a new and "updated" version but then i realised that i missed a single , and then the whole thing worked. Welcome to programming me!
perfect timing on this video Shaun! I was literally just finishing up the ARPG series when you uploaded this. I was just thinking to myself "I really hope i can find a good resource for an inventory system" haha. Thanks so much for all of the work you have put in! It has helped me and many others SO MUCH! I did run into some problems with the saving and loading features on the ARPG series, not sure if it was an issue on my end or not, but I will have to rework it later on down the line. In any case, thank you again!
Great! I have tried to find a good tutorial but noone have done a complete series! I would love to se how you can pickup an item with the mouse and also how to make like the Number one itemslot to make that the player holding it or something like that!! Shaun, you are absolutly the best youtuber I know! Love everysingle video of yours!!
Awesome! I'm glad you are keeping this simplified. I see a lot of inventory systems that are mouse based. It would be nice to see a tutorial on how to navigate an inventory system using a game controller or keyboard buttons instead of using a mouse cursor.
Make sure to set the sprite origins to Top Left, GML does not default to this unless you tell it to in the options. I was having some overlay issues because of this.
Hey man! Big fan of your tutorials. I know you're probably sick of people asking for videos, but I'd love to see some more boss battle videos or even paid tutorials some time? Thanks for all your great content 😁
Boss battles is a tough subject for the same reason this is a tough subject. Everyone wants something different. It's harder to find something generic for boss battles. I don't really want to do paid tutorials, udemy "courses" etc, as I'm already paid to make these free videos for everyone and I'd rather my incentives stayed that way.
@@SaraSpalding that's a great point, it is a very broad subject. Maybe even some basic boss ai tutorials like movement seqences or so it attacks, then does x animation then does another attack? Sorry if I'm talking complete nonsense or if this is supposed to be basic stuff. I'm not really sure where to start where it comes to more complex ai that doesn't involve it just following the player and doing one attack😅
This is an absolute God send! I think where most people struggle in terms of inventories is how to manage the item data structure e.g. object item that has various characteristics. What is the best practice way to setup, store and handle them.
In case anyone gets stuck with this issue I had, where the sItems and sSlot sprites where offset from sInventory, make sure that the origin is the same for all three. For whatever reason middle-centre will show them offset, but having them all at top-left will work.
Had a particularly difficult but fun time designing an Earthbound style inventory system not too dissimilar to this, but also features multiple arrays for each party member that can trade items, give items, equip items, and throw items away. The inventory always sorts the items upward as well. Towards the end of it I was thinking about how a Final Fantasy style inventory would be made which would be easier in some ways and harder in some ways.
Haha, amazing tutorial basics to create a foundation to work from. I appreciate you doing this and look forward to more. Going to use this in my personal project working with pieces from your Action RPG series. Thanks for helping people learn GMS.
I think probably the most common extensions you could cover are: - An inventory which can be rearranged - An inventory which, upon removing an item, moves the later items over so the only empty slots are at the end - Stacking multiple of the same item together in a given slot While I'm here, a video I might like to see is over how to set up enemy AI/pathfinding/those sorts of things.
7:00 What does key press - R say? I wanted to link it to a key press I and a pause menu option just not sure which command to use hmmmmm. Any idea appreciated!
My game is simpler so I just added a for loop to the object... If I add more objects I'll use the inventory function but for now I just called oGame.inventory and looped along i to check for empty slots. Thanks for the base version and the drawing, it helped a lot!
So I followed this tutorial and everything worked great down to the tee! The only glitch is that if you don’t place it in the correct spot in your room, the slot sprite will be offset from the inventory and potion sprites. Just takes some trial and error to find the sweet spot in your room.
@@wishifil idk what was wrong for him, but if your problem is that the inventory slots are slightly offset, check if you activated nine slice. That was my problem.
i kind of figured out how to code stacking...just create anothor array call quantity, and fix o_mouse events and functions. i guess it'll be better to use struct but i know little about it. thanks to the video by the way, it gives me encouragement stronger than ever:))
i used a mashup of peyton burnhams inventory tutorial with this one, most of the code is from this tutorial but the items are structs and right now i am working on stacking, i really recommend peyton's tut bc thats how i learnt about structs if you still want to
Does this still wokr? Cause I got an error message during 3:22 at lines 7 and 5 and number 2 has a warning saying "number of arguements for draw_sprite_stretched expected 6 got 2"
even that explanaition is not enough to understand soem basics on simple examples (why i do that , and what will happen if i will miss that that and that) sorry for dumb
One quick follow up question... I created a little player that can move around the screen, and I want to pick up and item. In the item objects step event I did a place meeting with the item object and the player, and then called the add function with an instance_destroy after it. Unfortunately it gave me a weird error about something not set before reading it, but could figure out what was not set... should I be replacing "id" with something else in order to successfully pick up the item ? - Cheers :)
My way of doing inventory was to create multiple inventory slot objects and after the item collides with player it moves to first empty inventory slot which it finds with place_empty(x,y,list_of_objects);
Help! Please! This works great. I want the Inventory in the GUI layer and I cannot make that work. If I move the code to the "Draw GUI" event, it still shows correctly, but the mouseover functions break.
Is Structs now a better way to do this now? I've seen a few struct based inventory systems now and there seems to be a lot of advantages but I'm having a few struggles implementing in the correct way. I'd be really interested in a structs based tutorial for inventory systems if it is a good solution. Also this new video style is big poggies. Super easy to follow the logic.
I got 6 blue potions in a row the first time and 7 in a row the second time and also 7 orange potions in a row a bit later. It seems that randomness in GameMaker produces these rare events way too often. And yes, I did use randomize() because otherwise I'd get the same every single time.
I did create a similar system, a bit further and mine works fine with keyboard but can you show us how to use the mouse on the inventory once it is drawn ?
I need help with the tutorial. I have watched both and when i press play its just shows the backround and no inventory slots. I cant find the problem and i hope someone can help me because i am new programmer with no experience.
When you remove an item from the inventory array, how do you make it so that all items "slide left" to fill in the gap that was created? I need a system that sprite draws to adjust to these item slot removals.
I just made it a global variable So i am having a problem with the inventory variable. When i click on the gui slot it throws an error because inventory isnt a global variable Error: Variable .inventory(100004, 9) not set before reading it Traces it to oMouse object If (mouse_check_button(mb_left)) and (slotHover != 1) and (inventoryHover.inventory[slotHover] != 1)
Hi Shaun, your tutorials are excellent and have really helped with the game myself and my partner have been developing since the pandemic started and we've been locked at home! I purchased your dissolve shader via the store and its worked perfectly for 9/10 use cases we've thrown at it, but we've found a very weird glitch. I emailled you about it around 3 weeks ago using the "send message" on the YoYoGames website, but got no response. Have you changed email perchance?
What's up with the nine slice? I can't get it to work. I have it ticked and using the draw sprite stretched and it's only drawing the front left of it.
So how do you add something to the inventory when the player collides with it? Right now I have the function InventoryAdd(id,2); in the collision with the item I want to add, but it gives me the error "unable to find any instance for object index '-9' name '' at gml_Script_InventorySearch"
Hey Shaun, just curious as to why you went with arrays rather than a ds list or ds grid system?! … I’d personally found this very helpful and straight forward. Would you be able to add stacking and sorting as additional videos? Cheers :)
Because it's simpler, doesn't need manual cleanup and we don't need any of the features/benefits of ds structures. It might get swapped out if we add something that demands it, but given how flexible arrays in GM are since 2.3 it's kinda hard to see it.
I spent 17 minutes on the first 2 minutes because of the lack of included sprites. I don't need any source code because I can follow along, but included sprites (like in platform tutorials and ARPG) would be nice.
I decided to also add these 2 functions. They make "Don't Starve-like" crafting very easy to create: function InventoryCount(rootObject,ItemType) { var ii = 0 for (var i = 0; i < rootObject.INVENTORY_SLOTS; i += 1) { if (rootObject.inventory[i] == ItemType) { ii += 1 } } return(ii) } function InventoryClear(rootObject,ItemType) { if ItemType == -1 { //clear ALL the inventory for (var i = 0; i < INVENTORY_SLOTS; i += 1) { inventory[i] = -1 } } else { // clear an exact item for (var i = 0; i < INVENTORY_SLOTS; i += 1) { if (inventory[i] == ItemType) inventory[i] = -1 } } }
well, it doesn't work for me... I wrote "#macro inventory_slots 15; rowLenght = 6; inventory = array_create(inventory_slots, -1); randomize(); inventroy[0] = 0; inventory[1] = 0; inventory[2] = 1;" to create event and "draw_sprite_stretched (sInventory, 0, x-6, y-6, 12+rowLenght*36, 12+(((inventory_slots) div rowLenght)+1)*36); for (var i = 0; i < inventory_slots; i += 1) { var xx = x + (i mod rowLenght) * 36 + 2; var yy = y + (i div rowLenght) * 36 + 2; draw_sprite(sSlot,0,xx,yy); if (inventory[i] != -1); { draw_sprite(sItems,inventroy[i],xx,yy); } }" into draw event, then, I tried to play it and it didn't start and I got like a thousand errors
This is a year late but if anyone else is having this issue: You're consistent with it, but it is spelled 'length,' not 'lenght,' just fyi. Not sure if it's on purpose or not. Your actual issue though is that semi-colons do not go at the end of a macro. So your line should read: #macro inventory_slots 15
dude leaves out several important parts just assuming you know how to do it, like actually saving the sprite then applying it to the actual object so you can actually have a result. 0/10 video
This new style of tutorial is much better than before ! Good job and thank you Shaun !
It won't apply to every video but will be more common among stuff that's more complex.
The 'elaborating' style (if that's what you mean with 'before') helped me a lot to gain a firm understanding of what is going on, but if it's not about basic concepts but about how to get it done, this style is also fine.
These videos have helped me create:
- multiple player inventories
- unlimited chest inventories
- drag and drop items between inventories
- quick add between inventories
- add all from chest to player based on space available
- JSON save/load system to store all of the information
Thanks so much Shaun.
My next goals are:
- stacking
- sorting by type
I was very curious about stacking, i have a feeling it will be quite difficult
I want to close and open my inventory can you help me? or give me an idea of what codes to put in?
@@fivenightsatbonnieslayth5865 global.inventoryOpen = false to control it's status and if(global.inventoryOpen) check inside draw event
I feel like scripts like "remove" "add" "search" and such are such a no brainer but for the longest time I struggled to conceptualize it. Great tutorial, Shaun!
When I first saw this video, I didn't quite understand it and just copied the code and checked the results. After a year, I started to gradually understand what this video was talking about after making a few prot types. The example of fitting the last combat ship inspired me. (I was abandoned for an attractive inventory system.) Thank you!
Wow I'm currently trying to create an inventory system but haven't found a good one yet, I've watched your old tutorials but I feel lost not knowing which method to use, thanks for uploading this video!
Same! I’d tried and failed at making my own from scratch. Actual life saver
Very good tutorial, so much information and practical coding in such a short timeframe.
Some suggestions for continuing this series;
- Make a special row of slots for quick access, something like the one used in minecraft.
- When using an item or deleting from the list start from the back, so the inventory keeps it's filled slots to the top and front of the list.
- Make a few extra icons inside the inventory window, one for dropping an item and one for destroying an item to drag the items to with mouse.
- Make a split screen inventory for multi player and merchant type interactions. To the left the person you're interacting with and to the right your own inventory. With some action icons for offering items and accepting the offer of the other person.
Don't be dumb like me: meticulously rechecking the code multiple times, wondering why nothing is happening when running the project, only to realize I forgot to put the inventory object in the starting room.
happens to me almost daily
I often use a controller object, mostly build in into a menu controller.. this object is the only thing I place into the room, the controller creates the other instances to be placed in the room so I can see what is needed and where, and can easily add or remove in this list.
Bro I wrote draw_sprite_stetched and wonder why it's not working XDDD
@@pronax5734 i had 1
THANK YOU
I was about to tell a whole paragraph on why you should make a new and "updated" version but then i realised that i missed a single , and then the whole thing worked.
Welcome to programming me!
perfect timing on this video Shaun! I was literally just finishing up the ARPG series when you uploaded this. I was just thinking to myself "I really hope i can find a good resource for an inventory system" haha. Thanks so much for all of the work you have put in! It has helped me and many others SO MUCH! I did run into some problems with the saving and loading features on the ARPG series, not sure if it was an issue on my end or not, but I will have to rework it later on down the line. In any case, thank you again!
The editing makes it so much easy to understand, Tq so much Shaun ✨
mucho gracias broski
Muchas*
Great! I have tried to find a good tutorial but noone have done a complete series! I would love to se how you can pickup an item with the mouse and also how to make like the Number one itemslot to make that the player holding it or something like that!! Shaun, you are absolutly the best youtuber I know! Love everysingle video of yours!!
I see a nice change of format for these tutorials. Clear and fast, just how I like it.
Awesome! I'm glad you are keeping this simplified. I see a lot of inventory systems that are mouse based. It would be nice to see a tutorial on how to navigate an inventory system using a game controller or keyboard buttons instead of using a mouse cursor.
That's generally easier actually as you just operate on slot numbers / grid positions rather than arbitrary mouse coordinates.
Make sure to set the sprite origins to Top Left, GML does not default to this unless you tell it to in the options. I was having some overlay issues because of this.
Yes, I am VERY interested.
Keep up the good work m8!
Saved me from a mental breakdown once again; You're the best dude, lol
Hey man! Big fan of your tutorials. I know you're probably sick of people asking for videos, but I'd love to see some more boss battle videos or even paid tutorials some time?
Thanks for all your great content 😁
Boss battles is a tough subject for the same reason this is a tough subject. Everyone wants something different. It's harder to find something generic for boss battles.
I don't really want to do paid tutorials, udemy "courses" etc, as I'm already paid to make these free videos for everyone and I'd rather my incentives stayed that way.
@@SaraSpalding that's a great point, it is a very broad subject. Maybe even some basic boss ai tutorials like movement seqences or so it attacks, then does x animation then does another attack? Sorry if I'm talking complete nonsense or if this is supposed to be basic stuff. I'm not really sure where to start where it comes to more complex ai that doesn't involve it just following the player and doing one attack😅
@@Thenesrookie try state machines, there are a lot of tutorials for this and even on this channel
@@memeguy8185 will check it out. Thanks! 😊
I’d tried and failed at making my own from scratch. Actual life saver, tysm
Shaun thank you. Looking forward to this!
Thank you so much! This new style of editing is awesome, appresiate the extra effort you put in. It makes it much more snappy and easier to understand
Thanks for keeping this up, Shaun! Legendary!
This is an absolute God send!
I think where most people struggle in terms of inventories is how to manage the item data structure e.g. object item that has various characteristics. What is the best practice way to setup, store and handle them.
awesome, quick, straight to point!
In case anyone gets stuck with this issue I had, where the sItems and sSlot sprites where offset from sInventory, make sure that the origin is the same for all three. For whatever reason middle-centre will show them offset, but having them all at top-left will work.
And this is why Shaun Spalding is the goat of GameMaker Studio
Goat?!… not exactly a compliment… especially in the UK! 😂
@@scotsparaman Hahaha, apologies, where I am from, goat is an acronym for greatest of all time
@@nicholasalexander9922 😂… brilliant
Im impressed that those magic formulas to make the slots break line works within my inventory system which is really different from this tutorial
Great video! Any ideas on how to stack items?
Had a particularly difficult but fun time designing an Earthbound style inventory system not too dissimilar to this, but also features multiple arrays for each party member that can trade items, give items, equip items, and throw items away. The inventory always sorts the items upward as well. Towards the end of it I was thinking about how a Final Fantasy style inventory would be made which would be easier in some ways and harder in some ways.
Haha, amazing tutorial basics to create a foundation to work from. I appreciate you doing this and look forward to more. Going to use this in my personal project working with pieces from your Action RPG series. Thanks for helping people learn GMS.
That's awesome thanks Shaun.
I think probably the most common extensions you could cover are:
- An inventory which can be rearranged
- An inventory which, upon removing an item, moves the later items over so the only empty slots are at the end
- Stacking multiple of the same item together in a given slot
While I'm here, a video I might like to see is over how to set up enemy AI/pathfinding/those sorts of things.
I love your work! and i have a good idea for a future inventory tutorial! mouse controls!
Any idea how to make equippable items? Have a character equip a helmet for instance, and then have the helmet display on the character?
7:00 What does key press - R say? I wanted to link it to a key press I and a pause menu option just not sure which command to use hmmmmm. Any idea appreciated!
My game is simpler so I just added a for loop to the object... If I add more objects I'll use the inventory function but for now I just called oGame.inventory and looped along i to check for empty slots.
Thanks for the base version and the drawing, it helped a lot!
So I followed this tutorial and everything worked great down to the tee! The only glitch is that if you don’t place it in the correct spot in your room, the slot sprite will be offset from the inventory and potion sprites. Just takes some trial and error to find the sweet spot in your room.
Update: I had a typo as I went though my code. All is well!
@@digitalswordplayik it’s 2 years later and there is probably no way you remember what was wrong but, do you remember what it was?
@@wishifil idk what was wrong for him, but if your problem is that the inventory slots are slightly offset, check if you activated nine slice. That was my problem.
i kind of figured out how to code stacking...just create anothor array call quantity, and fix o_mouse events and functions. i guess it'll be better to use struct but i know little about it. thanks to the video by the way, it gives me encouragement stronger than ever:))
i used a mashup of peyton burnhams inventory tutorial with this one, most of the code is from this tutorial but the items are structs and right now i am working on stacking, i really recommend peyton's tut bc thats how i learnt about structs if you still want to
How am i supposed to get the inventory to show up when I run it PLease help
great video! very helpful
Does this still wokr? Cause I got an error message during 3:22 at lines 7 and 5 and number 2 has a warning saying "number of arguements for draw_sprite_stretched expected 6 got 2"
Probably didnt seperate the parameters with comas
@@SaladAss1 i did, i compleatly copied it character by character i even asked friends if there was any difference al of them said no
@@jag-ca well it’s not the codes fault, you’ve obviously made an error.
Ok this is what I need
even that explanaition is not enough to understand soem basics on simple examples (why i do that , and what will happen if i will miss that that and that) sorry for dumb
One quick follow up question... I created a little player that can move around the screen, and I want to pick up and item. In the item objects step event I did a place meeting with the item object and the player, and then called the add function with an instance_destroy after it. Unfortunately it gave me a weird error about something not set before reading it, but could figure out what was not set... should I be replacing "id" with something else in order to successfully pick up the item ? - Cheers :)
My way of doing inventory was to create multiple inventory slot objects and after the item collides with player it moves to first empty inventory slot which it finds with place_empty(x,y,list_of_objects);
Great tutorial 👍
make sure to set all the sprite origins to top left!
Help! Please! This works great. I want the Inventory in the GUI layer and I cannot make that work. If I move the code to the "Draw GUI" event, it still shows correctly, but the mouseover functions break.
hey, did you figure this out? I'm having the same problem
@@allofyoualways try creating a new instance layer specifically for the inventory and placing the inventory object on that layer
Can u please do a drag and drop inventory with stacking please
how do i convert this into a stackable inventory, that displays qty and item name without using a ds grid?
+1 inscrito, a legenda em pt-br ajudou muito, thank you.
Is Structs now a better way to do this now? I've seen a few struct based inventory systems now and there seems to be a lot of advantages but I'm having a few struggles implementing in the correct way. I'd be really interested in a structs based tutorial for inventory systems if it is a good solution.
Also this new video style is big poggies. Super easy to follow the logic.
I got 6 blue potions in a row the first time and 7 in a row the second time and also 7 orange potions in a row a bit later. It seems that randomness in GameMaker produces these rare events way too often. And yes, I did use randomize() because otherwise I'd get the same every single time.
Oh cool I’ll save this for later
Does anyone know how I would add stacking to this system? Been trying but can't find out which way to do it and where you would put the code.
I don't know why but the drawing part seems not working for me and i can't find where's the problem. can someone help me?
I did create a similar system, a bit further and mine works fine with keyboard but can you show us how to use the mouse on the inventory once it is drawn ?
Cool video, thanks!
How create a stacking inventory?
I need help with the tutorial.
I have watched both and when i press play its just shows the backround and no inventory slots.
I cant find the problem and i hope someone can help me because i am new programmer with no experience.
When you remove an item from the inventory array, how do you make it so that all items "slide left" to fill in the gap that was created? I need a system that sprite draws to adjust to these item slot removals.
Majority of games don't do this. 90% of the games ive played in 23+ years the slot stays empty if the item is used. No need to complicate it
@@AstriaTVTruthExposed It's not about what other games are doing, it's what I want to do. And the game I'm remastering does exactly this.
Why are the inventory slots stacked on top of each other?
is there a way to make individual rows have different lengths?
Im interested at making something like the binding of isaac item system can you help
I just made it a global variable
So i am having a problem with the inventory variable. When i click on the gui slot it throws an error because inventory isnt a global variable
Error:
Variable .inventory(100004, 9) not set before reading it
Traces it to oMouse object
If (mouse_check_button(mb_left)) and (slotHover != 1) and (inventoryHover.inventory[slotHover] != 1)
This prob should have been put in the 2nd video...
Hi, where do I start in your videos to learn how to code in GML?
Could you make a resident evil style inventory tutorial?
Hi Shaun, your tutorials are excellent and have really helped with the game myself and my partner have been developing since the pandemic started and we've been locked at home! I purchased your dissolve shader via the store and its worked perfectly for 9/10 use cases we've thrown at it, but we've found a very weird glitch. I emailled you about it around 3 weeks ago using the "send message" on the YoYoGames website, but got no response. Have you changed email perchance?
What's up with the nine slice? I can't get it to work. I have it ticked and using the draw sprite stretched and it's only drawing the front left of it.
Have you dragged the purple lines into the right place? You have to use them to cut it into 9.
2:43 YOU CAN DO THAT? I've been using game maker for years and never tried that. Lol
So how do you add something to the inventory when the player collides with it?
Right now I have the function
InventoryAdd(id,2);
in the collision with the item I want to add, but it gives me the error
"unable to find any instance for object index '-9' name '' at gml_Script_InventorySearch"
im getting variable index out of range, did you ever find a solution to this?
how do i get the object to follow the view port and scale with it.I place it in the room and it does its own thing at the side of the screen.
draw_gui event
se puede lograr en gm1.4 estoy aprendiendo a crear inventario en gm1.4 please .saludos ...
Hey Shaun, just curious as to why you went with arrays rather than a ds list or ds grid system?! … I’d personally found this very helpful and straight forward. Would you be able to add stacking and sorting as additional videos? Cheers :)
Because it's simpler, doesn't need manual cleanup and we don't need any of the features/benefits of ds structures. It might get swapped out if we add something that demands it, but given how flexible arrays in GM are since 2.3 it's kinda hard to see it.
@@SaraSpalding I'm very glad you chose the more simple direction of going with arrays.
how can i add items upon touch?
collision event with item or player. InvAdd();
How to equip items?
You could move the items to a second inventory that counts as your "equipment" and only allow certain items in certain slots, etc.
@@SaraSpalding thought as much. I think I could do something with states to change characters abilities and sprite
I got error :((
Turns out, you do have to actually check the Nine Slice button or everything goes horribly wrong.
💖
4:31
I spent 17 minutes on the first 2 minutes because of the lack of included sprites. I don't need any source code because I can follow along, but included sprites (like in platform tutorials and ARPG) would be nice.
I decided to also add these 2 functions. They make "Don't Starve-like" crafting very easy to create:
function InventoryCount(rootObject,ItemType)
{
var ii = 0
for (var i = 0; i < rootObject.INVENTORY_SLOTS; i += 1)
{
if (rootObject.inventory[i] == ItemType)
{
ii += 1
}
}
return(ii)
}
function InventoryClear(rootObject,ItemType)
{
if ItemType == -1
{
//clear ALL the inventory
for (var i = 0; i < INVENTORY_SLOTS; i += 1)
{
inventory[i] = -1
}
}
else
{
// clear an exact item
for (var i = 0; i < INVENTORY_SLOTS; i += 1)
{
if (inventory[i] == ItemType) inventory[i] = -1
}
}
}
My inventory is tiny while yours is giant.
followed exactly still got a blackscreen, fucking cool
well, it doesn't work for me...
I wrote "#macro inventory_slots 15;
rowLenght = 6;
inventory = array_create(inventory_slots, -1);
randomize();
inventroy[0] = 0;
inventory[1] = 0;
inventory[2] = 1;" to create event and "draw_sprite_stretched
(sInventory, 0, x-6, y-6, 12+rowLenght*36, 12+(((inventory_slots) div rowLenght)+1)*36);
for (var i = 0; i < inventory_slots; i += 1)
{
var xx = x + (i mod rowLenght) * 36 + 2;
var yy = y + (i div rowLenght) * 36 + 2;
draw_sprite(sSlot,0,xx,yy);
if (inventory[i] != -1);
{
draw_sprite(sItems,inventroy[i],xx,yy);
}
}" into draw event, then, I tried to play it and it didn't start and I got like a thousand errors
same...
This is a year late but if anyone else is having this issue:
You're consistent with it, but it is spelled 'length,' not 'lenght,' just fyi. Not sure if it's on purpose or not.
Your actual issue though is that semi-colons do not go at the end of a macro. So your line should read:
#macro inventory_slots 15
dude leaves out several important parts just assuming you know how to do it, like actually saving the sprite then applying it to the actual object so you can actually have a result.
0/10 video
What do you mean "saving the sprite"?
2:42