loop

  1. FrostyCat

    GML GML Joseki Series: for Block Recipe Cards

    GML Joseki Series: for Loop Recipe Cards GM Version: GMS 2.3+ Target Platform: All Download: N/A Links: N/A Summary: A quick reference for a range of common use cases for the for loop. Summary This guide documents a number of common for loop patterns, best practices, and novice mistakes as...
  2. shortbread

    Released Looper

    Come discover the wonderful world of loops, with puzzles and challenges that will be sure to keep you on your toes! Looper is a unique puzzle action game with a variety of mechanics across 18 levels! Developed for Ludum Dare 47 Jam in 72 hrs Play / Download (HTML5 and Windows)...
  3. zendraw

    GMS 2 move a point along path

    so i want to move a point in a path, in a loop somthing like this var i=0; repeat (path_length) { path_position++; } but how to do it? you cant set a point manually on a path. path_position is read-only.
  4. paulog

    Legacy GM Random terrain generator very slow

    Hello! I'm thinking about adding a random terrain generator to my game, so I created an empty project to test some codes. I managed to do something I like, but the problem is that it's somehow really slow. I'll atach the code I used in the end of this post, but basically: -There is a loop...
  5. S

    Trouble getting out of loop when creating instances on my Enemies

    So I am trying to make a multi layered shield (randomly set) anywhere from 1 to 3 objects on top of my enemy and each shield chooses a different frame depending on what layer it is. theres 3 different color shields and I want it to choose 1 color per layer but for some reason it continues the...
  6. Lens

    SOLVED How to make a plane loop movement?

    I have a horizontal 2D object (plane) which, after an specific event, should a loop (not the loop variable, I meant an actual 360° movement). For that to happen, I thought about having the plane's image change its image_angle to a fix temporary center, while having: I. negative vspeed (goes...
  7. William Garrison

    GMS 2 Sound playing every step. (need to stop that)

    Okay so simple enough I want a hover sound to play when the characters HSP (horizontal speed) is > 0. So if this is the case and its HSP > 0 then I set the hovering var to be true. Otherwise its false. Once hovering is true I do the following (hovering code included). PLAYER - CREATE hovering...
  8. Momfus

    GMS 2 Strange behavior with deactivated objects on pause

    I have a problem that i'm not understand very well...I have two layers: control and hud layer All hud elements and the object that control all the gui elements are childs of parent_guiElement When i pause the game, i deactivate all object excepto the control layer, then when i resume all...
  9. L

    Windows Spine animation loop problem

    i made an animation in spine.it has 61 frames(from frame 0 to frame 60). And frame0 is defferent from frame60 when the GMS2 play this animation. it will play 60 frames but not 61 frames. the image_index will be 0 to 59. when image_index is 0. GMS2 will draw either frame0 or frame60. it seems...
  10. Smenkare

    (SOLVED) Changing values in all positions in ds_list

    for(i=-1; i < exampleListSize; i++) {ds_list_replace(exampleList, i, 0)} Will it work? And is there faster way? I have like 500 positions in ds_list and i want to be able to change them all to 0.
  11. Smenkare

    Creating from, picking random and adding to ds_map

    Let me explain my problem in this example. i have variables for each object objvar1 = 1 obj1disable = false objvar2 = 1 obj2disable = true objvar3 = 3 obj3disable = false objvar4 = 1 obj4disable = false one empty ds_map and i have 4 objects...
  12. B

    GMS 2 Search for ds_map value

    Hello :) , I have a question over a code I am breaking my head over for several days now! I have this line of code where you get different rewards depending on the number. For example if you win coins, you get +100 coins etc. In this case you win a new football. I have a ds_map that stores...
  13. B

    GMS 2 How to create an algorithm

    Hello dear community :) I really need help with this peace of code. I have a Level room where there is an Object that checks, when created, how much stars (0-3) each level has saved on the ini. Then it changes the image_index of each level button to match the amout of stars. 3 stars are yellow...
  14. A

    GML Crash when looking for object index in a for loop [SOLVED]

    I'm having a very odd error pop up seemingly at random. The odd thing about this is this doesn't crash all the time and I cannot figure out why it's crashing because it says it's looking for an object index in the for loop statement which doesn't make any sense to me. When I run debugger and...
  15. F

    Loop freezing when repeating too much

    So I have a loop counting down a number of rooms I want to place in a procedually generated dungeon, I have it set to where there is an attempt per room if there are 2 failed attempts a time is incremented which after reaching a certain value, ticks down the main number of rooms placed value...
  16. S

    Asset - Scripts repeat for_all

    So.. I made this a while back... noticed it's only on the old forums, so I'll post it here too. for_all This library adds the repeat for_all construct. The repeat for_all(x) syntax is an emulated language construct, enabling a foreach-like loop structure in gml. In many languages, there...
  17. B

    Circular loop through 2D array

    While I'm worried this is above me, for reasons regarding depth I would like to loop through a 2D array starting at a given position and "spiraling" out from that point. The most helpful thing I found online was this https://stackoverflow.com/questions/398299/looping-in-a-spiral?rq=1, however it...
  18. K

    Windows looping object change

    Hi, i'm struggling to make a looking object change, I'm managing to change one time, then it stops. I have this code in the 1ºst obj: Create Event: set Alarm 0 to 45 execute code: image_speed = 0.2 Alarm Event for alarm 0: set Alarm 0 relative to 100 change the instance into object...
  19. PlayerOne

    GMS 2 Creating objects from the tile layer

    I'm trying to make to improve this code by spawning all the collision objects for any given level by placing tiles in the room. Current I got the intended effect but it's very slow and I need to make this instant when the room starts. Tried using a for loop but it doesn't work at all. Any help...
  20. Corey

    (Fixed)Global variable/Alarm/instance_create issue

    Edit: Disregard. I fixed my problem by adding a Step event with global.enemyCounter = currentEnemies; to check the counter every frame and switched my Alarm event code to check conditions before spawning an enemy. Hello all. I have tried countless times to fix my problem. I am somewhat...
Top