object

  1. P

    GameMaker Mouse-drag object goes through wall

    I have an object (uses physics) that I drag around with the mouse. Create event code looks like this: depth = -1000; grab = false; xx = 0; yy = 0; Step event code looks like this: if(grab==true) { xo=phy_position_x+xx; yo=phy_position_y+yy; phy_speed_x = mouse_x-xo; phy_speed_y...
  2. N

    Legacy GM Depth [solved]

    How can I set the depth of one instance? Because my semi-solid-platform (one way platform) appears in front of the other semi solid platforms. See PNG: But I want it as in the room editor: That the 2 bottom platforms are in front of the top one. I knew about the object_set_depth function...
  3. X

    GML Is it better for run-time to have multiple objects or a single object with multiple states?

    Lets say you want to have different types of projectiles for different weapons. Would it be wiser for better fps to have an object for each projectile type or have the projectile be a single object that has different types?
  4. jujubs

    GML Best way to ping-pong object (SOLVED)

    Hey everyone. I'm currently working on an enemy for my game which moves down the screen whilst swaying left and right. I achieved this by making it spawn two other objects that sit beside it and send it flying to the other. This works, but makes things needlessly complicated, I guess. I can't...
  5. H

    How to attach and object to another object?

    So an object is moving from for example 1920 to 0, and an another object stay's in collision. I want the other object always being attached to the first object, how can i do it? Thank you guys!
  6. M

    Windows Hi, I'm new. How to place player on top of an object?

    I have two layers. One for the player and one for the floor. When I try to place the player object on top of a grass object it is not aligned with the grass object.
  7. S

    Legacy GM Object movement with paths

    Hello everyone! I've been struggling for several days with the objects movement through paths, and it would be awesome if someone could help me out a little with an issue I have. What I want to do is to have pedestrians moving around in paths I specifically designed for them. So far, I could...
  8. E

    Legacy GM ISSUE WITH DESTROYING OBJECT IN NEXT ROOM.

    hey yall. just having a small issue with destroying an object in the next room, im using a level system so when you reach a certain level, some things are deleted. heres the code. and yes the room uses physics. /// room end with (obj_player_stats) { if level = 2 { audio_stop_sound(sad_snowfall)...
  9. S

    GameMaker Detecting all objects within a specific range

    I have a combat system that changes the behavior of enemy AI based on what other enemy AI are surrounding them. I need some sort of way to detect all of the objects near each enemy. I considered storing every enemy object's x and y coordinates in a list, and then creating a script to determine...
  10. inertias

    Help me understand this code that works

    So someone asked a question on reddit about instances following the individual object that creates them. If you look at the posted solution, it works perfectly but I don't understand why. Here's what they wrote: Haven't been programming for long so I don't understand the "inst.creator"...
  11. K

    Legacy GM "with" command destroying wrong object

    Bit of an odd problem here. I have it so that when my player land on top of an enemy the enemy gets destroyed - sort of similar to how the Mario games work. The issue is that the "with" command is completely destroying the wrong instances, in fact it's destroying every instance of a type of...
  12. I

    Need help keeping cursor inside object.

    Hello! How can I keep cursor inside an object? For example, I have a volume slider and I want to keep cursor inside it until mb_left is released. I'm also going to hide the cursor and change a sprite of the slider. But first i want to figure out how to keep the cursor inside the slider when...
  13. D

    Question - Code Is it possible to remove an Event during run time?

    Hello! I would like to remove the Step Event for some objects during run time (i.e, while playing the game) via code, is it possible? For example, let's say I have an object with Step Event defined in IDE. Then I run the game, start playing, an instance of that object is created, and later I...
  14. Z

    Layer Depth Assignment From An Object To Another [SOLVED]

    Hi everyone ! I have two objects : - The first one is the one the player controls. Named "PLAYER". - The second one is an object (rather a group of objects) distributed on several layers. Each layer has its own depth and each object from that group take the depth of the layer on which it has...
  15. M

    Legacy GM Created exists instance is replaced by other created instance

    Hello I need help with my code because I tried everything what can I do with my skills and I don't know how to fix it... here is problem: https://imgur.com/a/P4iHi6c Just when particles (object/instance) exist and also created new one, exist particles is replaced by new one. I tried any...
  16. S

    Lighting on objects

    How to do a realistic lighting on objects? If a light directional light falls on an object, then the side of the object facing the light should be brighter than the other side.
  17. PlayerOne

    GameMaker [SOLVED] Drawing an object on screen

    So far this code will position an object on screen (not in the gui) and can be interacted with. This all works as intended. However every-time the player moves the object in question will shift slightly while still staying in place. I checked other forum posts for a solution but the results...
  18. N

    (SOLVED) Error when passing an object as a script argument

    Greetings, first time posting here. I'm trying to make a standard turn-based battle system, but I keep having trouble when starting the battle from a script. I'm trying to pass enemy objects as arguments, so the script assigns them to the enemy array in the battle_logic object. Here's my code...
  19. L

    Legacy GM Sentry Enemy Coding Help

    I'm working on a stealth game and revising some mechanics. I have a sentry enemy that used to have a constant, swiveling line of sight. I'm trying to change it at the moment so it instead lies "asleep" for a few seconds, "blinks awake" for a few seconds during which it can detect the player...
  20. Z

    Legacy GM Q:Unknown object.unknown variable

    why does this code if (place_meeting(x, y, par_alien)) { with (par_alien) { if (place_meeting(x, y, other)) { var abz=abs(z-other.z); if (abz<other.targ_range) { other.targ_range=abz; other.target=id...
Top