![]() |
Game Maker - Printable Version +- Blizzard Sector (https://www.blizzsector.co) +-- Forum: General Community (https://www.blizzsector.co/forum-3.html) +--- Forum: Tech Forum (https://www.blizzsector.co/forum-14.html) +--- Thread: Game Maker (/thread-44690.html) |
Game Maker - Nethran - 08-21-2008 Has anyone here used Game Maker? I suck with GML, as I have absolutely no coding background, and it'd be cool if someone here had made a game with it before and could help me. ![]() Also, I'd like to recommend it to people who would like to make games. ![]() Game Maker - Determinado - 08-21-2008 I did mess around with it a few years ago, but haven't really came up with anything spectacular. Ask away I would say, I know some php so who knows if we can help you with your problems. Game Maker - Nethran - 08-22-2008 Okay. ![]() Code: [B][SIZE=2]if[/SIZE][/B][SIZE=2] selected=[/SIZE][SIZE=2][COLOR=#800000]true[/COLOR][/SIZE][SIZE=2]&&[/SIZE][SIZE=2][COLOR=#000080]place_meeting[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]x[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#0000ff]y[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080]obj_inv_box[/COLOR][/SIZE][SIZE=2])&&![/SIZE][SIZE=2][COLOR=#000080]place_meeting[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]x[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#0000ff]y[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080]obj_invwindow[/COLOR][/SIZE][SIZE=2])[/SIZE] That's my inventory currently. obj_invwindow is my inventory window, obviously, and obj_inv_box is the area in which my items are stored, I made it a seperate object than the rest of my inventory window because, obviously, I can't have people dumping their items anywhere on the window. move_snap means that it's sectioned into 25x25px boxes that the items "snap" into when you click them into it. For you to be able to place items into your inventory right now, you have to click them, press "i" to open your inventory window, and then place them there. That's also how my equipment is supposed to work, I'm still working on it.. It's creating more move_snap boxes than I want and they're not centered on the area where I want equipment to go. I want to be able to click items on the ground that are close to me and have them automatically store themselves in my inventory window whether or not it's visible at the time, and they have to go somewhere other items aren't, or else a window pops up saying my inventory is full. The wondow part I can take care of. This is how I have it so that I can only pick up items close to me. Code: [SIZE=2][SIZE=2][B]if[/B] selected=[/SIZE][SIZE=2][COLOR=#800000]false[/COLOR][/SIZE][SIZE=2]&&[/SIZE][SIZE=2][COLOR=#000080]point_distance[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]x[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#0000ff]y[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080]obj_player[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#0000ff]x[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#800080]obj_player[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#0000ff]y[/COLOR][/SIZE][SIZE=2])<=100[/SIZE][/SIZE] [SIZE=2]The "selected" variable is defines in my parent object for all items, it's so that the items know that they're picked up and need to follow the mouse accordingly. The "global.pick" global variable is so that my character knows items are selected by the mouse and he cannot move until they are released. "stored" of course is whether or not they're stored in my inventory, and "equipped" is whether or not they're equipped. Their stats only apply to my character if equipped=true. [/SIZE] Game Maker - Determinado - 08-22-2008 If you want your items to automatically store like in diablo if you don't have the inventory opened, you simply need a global variable that switched between 0 and 1 when you open/close your inventory. You global variable would for example be "hud_invopen" apparently the whole 'selected' thing is a script that is in the game maker? If you want the items to go straight into the inventory this is a step you want to skip; better take a look at the script that stores your items in the inventory. Some steps the script will have to follow: 0) Check what script to run; hud_invopen=true -> The selected=true script, if hud_invopen=true -> The stored=true script 1) Check if there is place in the inventory (doing this first saves a silly bit of CPU load) and where 2) Check if the item is close enough to the player 3) On click, it should skip the 'selected=true' part and go straight for the inventory (I think this is stored=true? Can the player choose where he stores his items or does the game decide over this?) 4) Some debugging could go here I'm just logically thinking here, but those scripts seem really really small to me ![]() Game Maker - Nethran - 08-23-2008 I made all of the variables.. And with move_snap, I don't know how to make it check if the space is empty, that's why right now I have it so you pick up the item, open your inventory, an dplace it in what spot you want it. Game Maker - Determinado - 08-23-2008 Well, it's perhaps easiest to check which spaces are not empty, and then put the item in the next space that is 'not not empty' :p depends a bit on how it stores the items in the memory, you'll need to find the inventory script and take a good look at it and how it manages inventory space. Game Maker - Nethran - 08-24-2008 It's overly simple, which is my problem. "move_snap(25,25)" makes 25x25 boxes into which items "snap". That's all there is to it.. I have another simple script that replaces the one I'm holding with the one in my inventory, and that's basically how the whole thing works right now. I might be able to move it and check for a collision, but I'd have to have the inventory window pop up for a split second while it moves it into it, because if it's not visible, the items won't snap into place.. If there was a way to overcome that, I'd be a very happy person. Game Maker - Determinado - 08-24-2008 Well if you made the move_snap script yourself then you know how to overcome it, so I suppose you haven't made it yourself. You need to look in that script and check how items in the inventory are stored and how their position is stored. |