• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

coding

  1. 2

    GML Coding a basketball game.

    Hi everyone, I don't know where to go for this so I come here. You see, I am making a mini game for my GDD plan in game maker. I would like to make a basketball with my characters. This sport is perhaps one of the most intense thing to program in gaming in history because of the AI. What would...
  2. K

    GMS 2 How can I get (instance_number) for all objects in a room.

    Hello! I'm a complete amateur and have "some" questions. 1. What is the difference between instance_count and instance_number ? Is it the same thing but for different versions of gm? or are they completely different functions? 2. How could I get instance_number for every object in the room...
  3. M

    GMS 2.3+ Coding A Proper Hookshot?

    Hello there! I am currently working on a side scrolling platform game with a main focus being hookshot based grappling which the player will use to both traverse and fight/grab enemies using a button press based on the direction the player is facing similar to say 2D Zelda. Currently, I am able...
  4. Necromedes

    Pixel Collision with Sprint Button?

    I've started work on a top-down, action rpg of sorts. I'm using Shaun's platformer code as a base until I finish watching his tutorial on action rpgs. I have the code set up for horizontal and vertical collisions and those work just fine. However, I have set up a sprint/dodge key that increases...
  5. L

    Arrays to draw Text

    Hello everyone, I am currently working on a Point and Click Adventure in GM2. As I am still new to GML I am having quite a few problems with the coding language. Some of you might know, that clicking on an item usually triggers a text in Point and Clicks. At the moment I coded it this way: The...
  6. J

    question about tilesets... [closed]

    As of the time of this posting I have a rough level editor that swaps between several sprites (spr_wall, spr_floor, and so on). I also flip through the frames for different walls or floors depending on the sprite. I am wondering if it is possible to code a level editor that can use tilesets and...
  7. D

    GML how does this code work??

    inputDirection = point_direction(0,0,keyRight-keyLeft,keyDown-keyUp); inputMagnitude = (keyRight - keyLeft != 0) || (keyDown - keyUp !=0); hSpeed = lengthdir_x(inputMagnitude * speedWalk, inputDirection); vSpeed= lengthdir_y(inputMagnitude * speedWalk, inputDirection); x += hSpeed; y +=...
  8. L

    How do I stop motion_add?[SOLVED]

    So basically I want to stop motion_add so it happens only once or are there any alternatives beacuse I want to push player from guns rotation so how do I stop it or is there any other way to do it. Thanks in advance!
  9. T

    GML Ally and ememy AI

    I have some code below for a simple ally Ai. However I am not sure how to have the ally drone skip the top code if there are no enemies nearby. If I use if(!instance_exists(obj_Player)) exit; then the ally will just float off brain dead. Very new to coding and not sure what to do here...
  10. G

    GMS 2.3+ How do I loop over an array?

    Dear GMS2-community, I'm trying to loop over an array using the following bit of code: Click event object Q: a[0] = 0; a[1] = 3; a[2] = 5; for(i = 0; i < 3; ++i; ) if(instance_number(global.obj_target[a[0]])=0){ instance_create_layer( xx, yy, "Instances", global.obj_target[a]) } But for...
  11. Queble

    Can't figure out aspect ratio resizing

    Hey all! I am fairly new to gms2, and am currently creating a portfolio project for Android. My most recent problem, is that when I run the game on my android phone, I get these blinking white bars on the edges of the screen, which are obviously undesired. I have done a lot of...
  12. S

    Lil' problem with Enemy flashing

    So, I've got a little problem. I made it so that, when my Bullet object collides with the Enemy, the enemy's object flashes in white. The code is quite simple and small. The problem is that, on the first shot, the enemy doensn't go back to his normal state, and keeps white. It's solved on the...
  13. Mike?

    Issue with dash mechanic for movement

    Hello! This is my first time posting here and I'm in the middle of building my movement in Game Maker studio 2. I have horizontal movement down, however I can't seem to get the dashing ability work properly. In the create event, pretty straight forward stuff: move_speed = 300; key_left =...
  14. TyGamess

    Crafting

    If it seems like I post here a lot it’s because I can’t find the answer in the rest of the feed. I looked up “Crafting” before but they all had Questions on how to improve already Existing code. Basicly saying is I need help and I didn’t find the answer. So I have a parent Object for a set of...
  15. TyGamess

    Picking Up and Droping a Single Object

    I’m new(ish) to GMS2 but new to the website so I’m sorry if I’m positing this in the wrong area. But I’m having some problems woth “Picking up and Droping a single item” I’m making a game where you can only carry one item at a time. So I made the code and my character will pick one up but can...
  16. S

    cant get off ladder

    hi! so I put in code to make it possible for my character to go on a ladder and go up and down, but when I get on it, I can go as high as I want even though the character isnt touching the ladder object anymore. also, i cant move left or right on the ladder, or even jump off of the ladder, so...
  17. Sabnock

    [SOLVED] Line drawing Algorithm

    Looking for a good line drawing algorithm. I want to be able to per pixel colour a line so i can animate colour along the length of the line which GML does seem to cover i have looked on line and seen a few options but wanted to get advice on what was best for quick, efficient game use...
  18. A

    GMS 2 Destroying sprites form layer

    Hi, I need to destroy sprites called sTree from my asset layer. All 10 of them. Can this be done, if so how? Thanks.
  19. rawket

    GMS 2 Help with sprite change on asset layer

    So in an object I have this code for room start if areas_coastal == "burned" { layer_sprite_change(layer_sprite_get_id("buildings", "spr_diner1"), spr_diner1Burned); } It runs but the sprite doesn't change
  20. Null-Z

    Legacy GM (Please Don't) Exit stage left. SOLVED!

    For my Boss object, I have a phase where it hovers over the player before dropping down. I want it to move back and forth around the player's X before dropping. the problem? it just float's away seemingly ignoring the conditions I set for it. What am I misunderstanding? Functioning code
Top