while

  1. D

    SOLVED Collision not being detected

    Hello, i've been trying to use this method for checking the collisions on my game (Basically a 2D plataformer), but for some reason it's not working. movingh = hspeed; movingv = vspeed; if (place_meeting(x+movingh, y, obj_Floor)) { while (!place_meeting(x+sign(movingh)...
  2. B

    GMS 2 While Loop Problem

    The code below works great on my PC but on my Mac it creates this error: Unable to find any instance for object index '0' name 'obj_bridge' at gml_Script_scr_sort_list (line 18) - while (ds_list_find_value(global.control_group_none, j).list_priority < list_priority)...
  3. PlayerOne

    GMS 2 Vertical (vsp) Moving Platforms

    Finishing off my moving platforms for my project and this one is really giving me a headache. I have a vsp platform but my player object keeps cliping/falling through it when the platform goes up after hitting a wall. On top of that the game freezes, not crashes, no doubt due to the while...
  4. Drepple

    optimised loading screen

    Hello, I'm working on a project with a random room renerator. I created a second project to see how I would go about loading/generating and make sure it's optimised, by which I mean the game will perform as much calculations as it can untill the fps drops below 60, after which the game will...
  5. C

    Legacy GM While loop exiting too soon

    For some reason, if my fire_rate is 5 and the stat chooses "fire_spd", my draw event sometimes draws text "fire_rate" instead. My code does increase the values for fire_spd, but for some reason it draws different stat text in my draw event. With my understanding the code should at the end choose...
  6. S

    I have a problem with shooting things

    So, I want to make a top down shooter, but every time I try to execute the game it gives me this error: In Object Markus (the player), in Event Step event number 0 line 28 : malformed while statement. And this is the while statement: while (!collision && distance_to_point(temp_x, temp_y) <...
  7. I

    Is this a bug with "while" expression?

    Hi guys, i found this quite odd and wonder is this a bug? if i run this code: ev_file = file_text_open_read("abc.txt"); while (file_text_read_string(ev_file) != "") { array1[z] = file_text_read_string(ev_file); z++; file_text_realln(ev_file); show_message(array1[z]); } array1 will receive weird...
  8. A

    GMS 2 Please Explain, While vs. If Statement

    So I don't understand why this would happen, and I hoping one of you can explain this to me. I would like to know why this is happening so I understand my code better. If I type (code below) my entire game freezes and crashes while alarm[0] > 0 { speed = 0; } If I type (code below) my game...
  9. T

    GML Using While Loop To Make Tetris Quick Drop

    Hey everyone. I am trying to make a quick drop function in my Tetris game that makes the block instantly fall to the bottom when the player presses a certain button. Currently the blocks fall at a fixed rate of 16 pixels every second. So when the player presses the space key, I have a while...
  10. S

    Exit while loop

    I have a while loop that gets executed as long active = true. In one part of my code I want to exit the the while loop instantly without executing everything else that comes after this section in the while loop. Can I just set active = false, or will still still execute the last part of the loop?
  11. Shadowblitz16

    GMS 2 updating game in while loop?

    is it possible to update a object in a while loop? for example if I have a script that induces a keypad menu that loops until it is exited and then returns the value. would something like this be possible with event_perform? I am wondering so I can directly return the string into field element...
  12. D

    loop confusion

    Hey guys, I have a object that speeds upon at certain intervals, and I am wanting cap it at a certain value. I figured a while or a do until loop wrapped around this code would work, but now when I run my game, the object hits the goal which should speed it up a bit and increase the score by...
  13. J

    Legacy GM Help with infinite while loop [solved]

    Hi, I am trying to make a an object that will check for a collision, then stop checking for a collision for a second, and then start checking again. Currently, I have this while loop in a step event: while(alarm_get(0) <= 0) { if collision_line(x-96,y+15,x+96,y+15,all,false,true) {...
  14. 2

    Find Number of Instances I'm Colliding with, and Their Ids

    I'm trying to loop through to find how many collisions with Tree_obj I'm getting in the player's collision rectangle (actually place_meeting), and also get the id each loop. I'm only getting the value 0 for each when I don't overlap the object (that part's correct), and 1 for each variable when...
Top