code

  1. M

    how to exit code but not the whole Event?

    For a long time I was puzzled by why an enemy object's Create event wouldn't work (it would only play actions up until a certain point). Then I realized that in a code that is played in the Create Event, when certain conditions are met, it says the 'exit' statement; I originally meant for it to...
  2. mcglubski

    GMS 2 Array for Collisions HELP! [SOLVED]

    Can someone help me simplify this into an array or something else? Even with years of experience with GMS I still struggle to understand simple arrays, especially after coming back to it since buying GMS2. I feel like this should be easy but everything I try doesn't work. If someone could...
  3. R

    SOLVED collision problem

    Hello, I am having the most frustrating time trying to understand what I am doing wrong in my code, because the collision works sometimes and sometimes it does not. for example, sometimes I get stuck in the ground right at game start. And i have noticed this only happens when I apply a...
  4. K

    GMS 2 temporary buffs

    so, in my game there is a store and you can buy buffs, such as movement speed increase buff etc. right now, when you buy the buff, you gain extra movement speed, but it needs to end after some seconds, but i'm not being able to program that. so, there is an object in the store and when you...
  5. Dane Emark

    SOLVED Smooth grid movement

    Hi, I am totally new to the GameMaker forum:). NOTE: I am still using GameMaker Studio 1.4 so I don't know if Game Maker studio 2 code can work. I was making a test game to improve my programming skills. I wanted the player, the enemies, and the other objects to move on a fixed grid(32x32); here...
  6. flyinian

    SOLVED Out of curiosity, Is there a better way of doing this?

    Out of curiosity, Is there a better way of doing this? This is for a mouse hover highlight for a button. I was trying to get my navigation system for my game to not execute the button highlighting per step. This took me awhile to figure this out, a different version of this was executing...
  7. A

    SOLVED How can i change background colour (with codes)

    I want to make a rainbow effect on the background. How can I? edit:Okay guys i did it create event: global.TimeToGoUp = true global.Bgtimer = 0 step event: if(global.TimeToGoUp = true and global.Bgtimer = 500){ global.TimeToGoUp = false } else if (global.TimeToGoUp = false and...
  8. 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...
  9. M

    collision between two objects always stop both from moving, while there are no Actions to do so

    So in my game, a bullet object should pass through enemy objects. it should flash (the bullet) when it passes thru an enemy. however, if i add a collision event between the bullet and an enemy object for either one, they both freeze in their place (stop moving). the collision event can contain...
  10. bruhmoment.wav

    How do I let an object rotate the player, towards the mouse

    I'm pretty familiar with the GML Basics, but I just can't seem to be able to work this one out. What I want to happen is a gun point towards the mouse, that is able to move in a circle around the player if it is out of a certain radius of the player. This is the code that I currently have //If...
  11. flyinian

    How would a combat system like this be accomplished?

    I'm a little ahead of myself in my development road map but, I decided it may be a good idea to have at least a good idea on how I am going to do my combat system. I just brain stormed a combat system, the partial logic of it anyways. (The game is a text based simulation game) Essentially...
  12. L

    GML Fighting game round problem code

    Im pretty new to game maker but currently i have made myself a fighter game. Everything works including health bars and attacks What im struggling on in making code for a round based system. Im not sure how to implement such a code. when the game starts it will be state = round1, when...
  13. K

    help with colision code?

    thats the basic movement code for the obj_enemies if(instance_exists(obj_player)){ mp_potential_step(obj_player.x, obj_player.y, spd, obj_colision) image_angle = point_direction(x, y, obj_player.x, obj_player.y); what i want to do is: when the obj_enemies touch a obj_colision (that...
  14. Nathan

    SOLVED Please delete, did it an entirely different way

    I am trying to find (or write) a script or some code to make an asset layer flash like lightning. I'll be putting white squares outside windows of the stage, so I'd like to turn the opacity of the layer either on/off or real fast slide of the opacity scale to simulate lightning flashes. My...
  15. K

    animation before instance_destroy (help)

    i have this code for the enemy IA but when it dies the instance is destroyed without running the animation before how do i change that? mp_potential_step(obj_player.x, obj_player.y, spd, obj_colision) if (life <= 0){ sprite_index=spr_enemy1_death instance_destroy() }
  16. K

    SOLVED does anyone knows how to make a functional topdown 2d movement script?????

    var move_left = keyboard_check(ord( "A")); var move_right = keyboard_check(ord("D")); var move_down = keyboard_check(ord("S")); var move_up = keyboard_check(ord("W")); if (move_left && place_free(x-spd,y)){ x-=spd; } if (move_right && place_free(x+spd,y)){ x+=spd; } if...
  17. K

    SOLVED sprite_index in x and y axis change

    thats the code //for y axis if(y > mouse_y){ sprite_index = spr_player_back } if(y < mouse_y){ sprite_index = spr_player_front } if(y != yprevious && y > mouse_y){ sprite_index = spr_player_walkback } if(y != yprevious && y < mouse_y){ sprite_index = spr_player_walkfront } if(y < mouse_y...
  18. K

    walking animations mouse directioned topdown

    im not being able to use the sprite_index to change the sprite animation based on the position of the cursor on the y axis (when the mouse is above the character, we should be able to see him by his back, and when the mouse is under the character, it should be the other way around) any ideas?
  19. F

    Collision

    I have a doubt, I've already programmed the collisions for the character when he moves by the arrow keys, but I'd like to program my character to walk by WASD. Is there a code to program all the collisions like copying the code from arrow instead write everything again only changing for WASD?
  20. KyleRansford

    GMS 2 Spell Checking Dialog "strings"

    Is there a way to spell check "strings" that I've written dialogs with? I know (or at least haven't seen it) that GameMaker Studio 2 IDE doesn't have a grammar spell check, but is there away or some kind of program, where I can check for grammer spelling in the code that I've typed? I have a...
Top