code

  1. L

    need help adding sound while walking and stop when not

    function get_input() { if (keyboard_check(ord("A"))) left = 1; if (keyboard_check(ord("D"))) right = 1; if (keyboard_check(ord("S"))) down = 1; if (keyboard_check(ord("W"))) up = 1; if (keyboard_check_pressed(vk_space)) dash = true; } where would i add snd_walking sound when...
  2. L

    Player hurt sound plays when not being hit

    function perform_attack() { if image_index >= attack_frame and can_attack { can_attack = false; alarm[0] = attack_cooldown; var _dir = point_direction(x, y, obj_player.x, obj_player.y); var _xx = x + lengthdir_x(attack_dis, _dir); var _yy...
  3. VitorBiliato

    A Way to make a code smaller

    i have a code that scan for avaliable slots, but the problem is that it's giant, i tried to search a way to make it smaller but i only got " malformed assignment", this is the code: if (picked == false){ if(global.ItemSlot0 == "") { global.ItemSlot0 = itemName; picked =...
  4. L

    I Need help fixing error in my boss fight, I am trying to fix everything before my A level due date , ALL HELP APPRICIATED

    My plan for the boss battle is to have the boss hit the ground every 10 seconds that causes the whole floor to damage the player if they don't dash, when you dash you have a few seconds of immunity, I want the boss to flash white a second before i does the attack, the boss can be stationary and...
  5. M.G.

    GML Question about the experience bar

    Hello, I created a vertical experience bar. With the following code: Create: global.exp = 0 global.max = 10 Draw GUI: draw_sprite(spr_bar,-1,0,0) draw_sprite_ext(spr_exp,1,0,0,1,global.exp/global.max,0,c_white,1) With every mouse click I get an additional experience point. But there...
  6. QuareFromAPizzaTowerMod

    My collision code doesn't work

    Hey there, I'm having an Issue, I collide but when I try to get out of the block, I enter the block and i can't get out. CODE: var _xmove = keyboard_check(ord("D")) - keyboard_check(ord("A")) var _ymove = keyboard_check(ord("S")) - keyboard_check(ord("W")) if _xmove != 0 or _ymove != 0 {...
  7. WWAZman

    SOLVED custom high score save and reset not working?

    hi all.. I previously had a fully working simple game, Bonnie Counter, which hasn't been updated in what feels like eons.. it's a simple counter with a sound effect or three, that has a "all time high" as well as "this session" .. This session works, but now All Time High has broken, and neither...
  8. Dimsum Cart Studio

    SOLVED Chinese Font Problem

    I change the ini file to UTF-8 to fix the bug. =================================== Hello, I am using font editor and can't use it right. The English font is running good, but the Chinese font trouble me. I create a font asset and choose a Chinese Font, add all the characters I...
  9. 1

    GameMaker Trying to draw the ds grid

    Hello, I am trying to create a leader board with a ds grid. here is the create event for my leader board object leaderboard = ds_grid_create(2, 3); ds_grid_set(leaderboard,0,0,"Tom"); ds_grid_set(leaderboard,0,1,"Jim"); ds_grid_set(leaderboard,0,2,"Adam"); ds_grid_set(leaderboard,1,0,10)...
  10. M4N0X

    SOLVED Camera issues with room switch

    Hey everyone, i am pretty new to this whole programming stuff and i have annoying problem with my camera in-game. everytime i switch rooms my camera stops working, wich is rly annoying because the rooms are pretty big and i cant test things without knowing where i am. All my rooms have the...
  11. J

    Object: obj_inimigo Event: Step at line 5 : got 'if' expected ':'

    I have the following problem: Object: obj_inimigo Event: Step at line 5 : got 'if' expected ':' Object: obj_inimigo Event: Step at line 5 : got '(' expected '}' The code is: var range = 300 switch(estado){ case "parado" if(distance_to_object(obj_player)<= range){...
  12. T

    GameMaker Strange Problem with the Output of my Game

    Hi ,I'm getting this problem on the Output of my game , i think is an script problem but i dont have any scripts executing on the room and I delete any object and this kept popping out if someone knows what to do tell me pls...
  13. cramzeravla

    Why am I getting this warning?

    Can someone explain why I am getting this warning. This is from the Space Rocks tutorial, and I followed the steps. instance_copy(true); W GM2022 Return value of a pure function is not being used. obj_rock : obj_bullet 9:2
  14. pamelahoward

    SOLVED Particle Emitter Delay in Editor but not Game?

    Hey all, new to particles. I used the editor and clicked the "Copy GML" button. Wondering why the delay shows in the editor but not in the game? //ps_fw_1_trail var _ptype1 = part_type_create(); part_type_shape(_ptype1, pt_shape_flare); part_type_size(_ptype1, 1, 2, 0, 0)...
  15. I

    SOLVED GM 2016

    Hello, everyone and Happy New Year! 🎉 I'm relatively new to Game Maker so I decided to follow a Tutorial on a fan Undertale remake. I've been studying the tutorial, however I get the error message: "GM2016 - instance variable declared outside of Create event." Here is the code that I have...
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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...
Top