• 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!

variable change

  1. P

    Jump/onGround state/Collision? Interaction Issue

    Hi, I'm pretty new to GameMaker in and coding general. I have two versions of my code which I would expect to execute exactly the same, but do not. My project is basically just a practice proof of concept just to get something reminiscent of a game working. I know convention is to use hsp and...
  2. G

    Windows Upgrade function issues | Store Variable in Variable

    Hello, I have been working on my second game for a month now and wanted to add a series of upgrade Buttons to give the Player the ability to improve their stats (walking speed, mining speed etc.). I wrote a function that is supposed to be triggered if my button gets pressed. That works perfectly...
  3. W

    Legacy GM Can't stop character movement

    I'm going through my project and trying to make sure my character can't be allowed to move whenever certain things are going on like item menu being shown, or speaking to NPC characters, and for some reason it's only working half the time. For example when I speak to ONE NPC I can't move until...
  4. G

    Legacy GM Instance variable logic problem

    Ok is very simple, I have an object with this in create event: acc_y = -8; and this in the step event: if (acc_y < 12) { acc_y +0,25} y = y + acc_y; Now i thought that the istances of the object didn't share the internal variables. When I spawn one moster his speed will be like +5, but if i...
  5. M

    Changing the values in variables

    Hi everyone, I have a problem with my variables. When I create a new instance for my bullet in the bullet object I have. //create event movespeed = 16; grav = 0; bounce_force = 5; dir = oPlayer.image_xscale; hspd = dir * 4; vspd = 0; image_xscale = oPlayer.image_xscale; // step event hspd +=...
  6. N

    GML How script can change passed in variable

    I'm working on a button remapping system and since GM:S 1.4 has Joystick system instead all controllers being gamepads + there's no button_check_pressed for joysticks, I need to implement that too. At the moment the solution I see is the second variable for the button to check the previous...
  7. N

    GML [SOLVED] var instance_create() doesn't change instance variables

    I have a game master object that is creating controller objects and player objects in Room Start event but for some reason, It doesn't change needed variables (they stay as they are defined by default). All I need it to toggle what inputs controllers should respond. I don't get it, I thought...
  8. MIchael PS

    Legacy GM Variable access on Creation (?)

    Hello, I have a small question here. I have an obj_A and an obj_B. Through obj_ A, I create an obj_B, “instance_create(x,y,obj_B)”, and I want to access a variable in obj_B through obj_A, to change it. I don’t want to do it with “obj_B.variable” because I have a lot of obj_Bs and I want to...
  9. M

    How to change values like this?

    Is there any command to make any variable change, for example: hspd = 6 if hspd is a positive value, i want to make it negative,(if hspd = 6, then make it hspd = -6) and vice versa (if hspd = -6, then make it hspd = 6)
  10. J

    GameMaker Not Recognizing Defined Variable (???)

    Hi there, I'm an intermediate GMS2 coder and have come across a bug that I cannot figure out for the life of me. I've used this technique many times and I have never had this issue. What I'm trying to do is simple: Create an instance from another instance, then set variables for the new instance...
  11. A

    Legacy GM Need help with drawing changing variables (SOLVED]

    I don't know how to explain it, so I got two pictures here: As the variables get larger, the numbers start to go into eachother. I want it so the MAXHP will draw in front of the HP, like this...
  12. A

    GML [SOLVED]Need portrait to change with text, but only when sentence has finished.

    What I'm trying to do is simply: Let the portrait change whenever the sentence has reached its end and I press "Z". Initially when I pressed Z, even before the sentence finished, the portraits would change before the sentence was finished. if keyboard_check_pressed(ord("Z")) { por_current +=...
  13. R

    Legacy GM Affect Single Instance (RESOLVED)

    I have 10 instances that work on an AI that I need variables changed when they hit a specific object but ONLY when they hit the object individually. An example would be I have an enemy that when colliding with a trigger its variables are affected but not the other 9 instances of the enemy. it...
  14. R

    Change a variable by pressing a jpg/png

    I'm new to programming and am currently using GameMaker Studio 2 Drag And Drop. I'm trying to perform a simple task but can't figure it out... I want to alternate between two audio tracks playing simultaneously by pressing a jpg/png (with mouse left). When the variable "CSwitch" is set to 0, the...
  15. A

    Legacy GM [SOLVED]accumulate things to pressed a giant button

    If something falls on a button(player or enemies) it will be pressed, but to pressed a giant button it will require more weight. Every object has a "size" variable that is 1(though I plan to put giant enemies with a bigger number). The problem here is that I can't figure out how to stack/combine...
  16. J

    gamemaker choose variable by button

    Hey guys, I have this RTS Game in which i have workers. I want to choose what the workers are mining, but i want to be able to choose what each individual worker mines. I would like to choose what they mine with buttons that pop up. The only thing that has to occur is that a variable changes...
  17. Image index and global variables[SOLVED]

    I'm have an issue getting variables to add or subtract during a collision. I have the collision check if the image index, of the other object, is equal to global.state and this works fine when it come to destroying the instance however when it is equal it's supposed to add to global.score and...
  18. H

    Legacy GM Object with gravity doesn't pass throw solid objects

    I made a ball that falls in vertical directioin with gravity. In the step event I used the following code:... if (vspeed<6.2) { gravity_direction=270; gravity=0.35; } ... So the vertical speed stops growing before it reaches 6.2. When the ball colllides with a solid block, I made it bounce...
  19. K

    Legacy GM [SOLVED] GUI Updating Trouble

    Hello, I'm trying to beat my head on this problem but can't seem to figure out what's wrong. So I have an object called "GUI" that handles the GUI in the game, but I can't seem to get it to update/display properly. It's code so far is: Information about object: GUI Sprite: Solid: false Visible...
  20. Z

    Resetting Variable problem

    In my game that I am working on you can switch between two characters and also encounter upgrades to improve your characters abilities. However I have ran into a problem were I tried experimenting with a double jump upgrade where a certain character can obtain it and double jump at will...
Top