• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

code

  1. OldVales

    SOLVED Starting my journey... looking for a few "code design" guidelines.

    Hello everyone, First post here. I hesitated to post it in the "Game Design" forum but maybe here is better as it is about code. I am at the beginning of all this game making stuff, and I need some... "meta" guidelines, I guess. A bit of context: - I've tested GameMaker for like 3 weeks now...
  2. G

    GameMaker Trouble with array being out of range for NPC

    I've been working on an NPC dialogue system for my game, and right now it works with every NPC except for one. In one of the cutscenes (one which worked for the longest time, but seemingly has been broken or bugged due to me updating Gamemaker) it continuously crashes due to a variable being out...
  3. JesusOnExtasy

    Strange error in saving the game.

    Saves with the value "undefined" are not loaded correctly, namely, after loading, items are not put on the character. Here's my save for now. enum Type...
  4. X

    GameMaker Error in my code. Help desperately needed.

    I am currently working on a video game, and I encountered an error that I do not know how to fix. This is the error message: I understand what the error is and what it means, but I do not know how to fix it. I am using GML Visual. The code is for some basic movement mechanics. This is my code...
  5. feersow

    move_and_collide() or speed or me?

    Hello. I'm trying to use a built-in variable so as not to create unnecessary ones. Why reinvent the wheel if it's already been invented haha. So, the problem is that when it collides with an obstacle, the object’s speed noticeably decreases, as if the obstacle is viscous like a swamp, but the...
  6. Schim

    SOLVED Make camera follow Player and Mouse (Nuclear Throne/Enter the Gungeon like) without going off room

    Hey buds! Been trying to do some code for the camera and really didn't get why the camera is going out off my room. I think it is happening cuss I don't really have a way to stop it from going out. Have been trying to get some limit using the room_height/width but it didn't work out. Do anyone...
  7. nates.not.cool

    GML my textbox isn't displaying :( I keep getting this error message

    var _txtb_x = textbox_x + text_x_offset[page]; /// <--- this is the line its talking about /// var _txtb_y = textbox_y + text_x_offset[page] ; txtb_img += txtb_img_spd; txtb_spr_w = sprite_get_width(txtb_spr[page]); txtb_spr_h = sprite_get_height(txtb_spr[page]); // draw the speaker if...
  8. Dimsum Cart Studio

    GML How to deactivate the physics fixtures?

    Hi there, I am trying to use physics fixtures. But I find that the fixtures(or the physics collider) is still there after the instance is deactivated. Counld you please tell me what should I do if I want to deactive the fixture? Here below is the function what I run in the instance create...
  9. MrPugMC

    GameMaker Need help with ds_grid problem

    I am currently making an inventory and have come across a weird little problem. In the game you are able to pick up items from the inventory and move them around, everything works fine until you try to click outside the ds_grid while having an item picked up. Basically the problem occurs when...
  10. P

    GameMaker [SOLVED]Collision not working for enemy npc

    Hello im doing a hack n slash game and my enemy npc collision is not working (yet my player collision is at they are the same code) Collisions on sprites are okay. code for collision NPC (not working): if place_meeting(x + x_speed, y, oWaterAndHole) || place_meeting(x + x_speed, y, oEnemy) {...
  11. A

    Drawing an object in a specific layer order

    so I have my player and kept it persistent so various conditions with the player would be kept when the room changed but I have a layer order so different objects draw over the player and this works in the initial room but when the player moves to the second room this order is not kept so how...
  12. U

    I want to add different types of firing modes but I don't want to ruin the code I had build. (Top Down Shooter)

    So I have been think about this alot actually, and I had already made a code the allows my character to shoot a shotgun and a have a fully automatic guns but I want to add something like a single fire weapon that only shoot 1 bullet per click and also add something like a melee that when the...
  13. Red Needle

    Reduce component system boilerplate

    Hi, I'm attempting to create an entity-component system in gms2 using structs. However, I've run into an annoying issue where a component system function inherently involves a lot of ceremony and boilerplate. This is because each function needs to perform a lot of validation before the actual...
  14. MrBrainMatter

    GML Draw Mouse Over Help!

    Im trying to make it do this command draw_set_color(c_black); draw_text(x-15,y+35,"Upgrade " + string(cost)); draw_set_color(c_white); When The Mouse Is Over It I originally used // Code In Draw Event if(mouseOver(x,y,sprite_width,sprite_height)) { draw_set_color(c_black)...
  15. RockstarCRO

    SOLVED Using a sequence in a step event - Angry Shake

    I've been playing with sequences a bit and I think I got the editor down. The programming has been a bit of a different story. The premise is obj_player1 enters a section (in_section) and obj_c_AI_easy starts moving towards obj_player1 (path finding without hitting anything). Once it reaches...
  16. Nukrei

    GML Hold objects with physics

    I was trying to create a way to hold an object that uses physics for my project (like the People Playground), but when I was writing code to hold the object with the mouse, I couldn't get the object to continue with its speed and direction after you let go of it, it just stops and falls I'm...
  17. FilthyToad

    My attacks are only in effect for a single frame

    I have tried to implement a simple melee attack but after a single frame it is reverted to what it was before I haven't yet added a hp system but that is soon coming. Can someone please tell me the problem and a solution if (key_attack && on_ground) { if (!attacking) { attacking...
  18. A

    GameMaker How to add multiple choice questions in Windy Woods code template

    Now I want to customize the template, I want to add an object, when the player collides with the object a pop up question will show with 4 choices, the player can not walk once the player collides with the object, the player needs to first answer the question correctly in order to proceed, when...
  19. F

    Help me with a inventory system

    I'm trying to create a inventory system, and I want to insert in an array the objects that the player take. For now I'm using a string. And I want to put that string in the array. this is my code in the player's step event: if ((distance_to_object(obj_takeable) <= 10) &&...
  20. T

    GML Collision-Parent instance problem

    Ugh this is so confusing... I have no idea where to go with this. Basically I have this parent object and three colliding objects with my player object, accordingly collision1, collision2, collision3. (Note that this is not like this in my workspace but named as such just to provide more...
Top