1. D

    instance_destroy on the other object using collision_line

    I have the following code in the step event of obj_bullet which is doing a collision check on obj_wall and then destroying the bullet. if (collision_line(x, y, xprevious, yprevious, obj_wall, false, false)) { instance_destroy(); } How do I also make it destroy the obj_wall? I have tried...
  2. C

    Check small collision_lines for multiple instances

    Hello everyone, Only been using GMS for a little while and having an issue with multiple instances of an object using collision_line(); I have an object that detects if the player object is right below it or right on above it. Either way, when one of these collisions happens, another...
  3. M

    GMS 2 questions about collision_line

    now I use this command in this way if !collision_line (enemy_obj.x, enemy_obj.y, object_player.x, object_player.y, object_wall, true, false) { further a long code so that it follows the player } it only works on 1 enemy, only 1 enemy reacts to me, and thus, when he sees me, he launches a...
  4. Ratsha

    GMS 2 2D Hitscan

    GM Version: GMS2 Target Platform: ALL Download: N/A Links: N/A Summary: How to implement hitscan in 2D games using collision_line(). Tutorial: Code below for the hitscan code in Left Clicked Event. This includes a fix (gun_direction) that accounts for the gun's slightly offset in the Sprite...
  5. Ayziak

    GMS 2 Reference a parent object without the children?

    Hi all! In my game, the enemies cannot see the player through solid walls (OBJ_Solid) but should be able to see through OBJ_Platform's. I use this to detect the player: if !collision_line(x+4,y-4,Player.x,Player.y,OBJ_Solid,false,true) {//do something} My problem is that OBJ_Platform is a...
  6. T

    Legacy GM Frame rate drop when using collison_line (SOLVED)

    My game keeps dropping frames sometimes when I use a card attack that utilizes the code below to check for a collision and return an ID. This mostly occurs while the enemy is attacking, but sometimes it happens regardless. I wrote this code a few weeks ago as a solution to my previous issue I...
  7. jujubs

    GML [SOLVED] Shooting diagonally with collision_line

    Hi everyone. So I've been struggling with this for the last few hours, and after failing to find a solution elsewhere, I've decided to ask here: how do I check a collision with collision_line in other directions? Cardinal directions are easy, because it uses a rectangle, but I can't find a way...
  8. jujubs

    GML [SOLVED]collision_line weird behaviour

    I'm trying to do a hitscan weapon, and read elsewhere that collision_line was a good way to go about. So, I draw a line across the screen using this: if(test> 0) { draw_line(obj_player1.x+16,obj_player1.y-1,obj_player1.x+1000,obj_player1.y+1); } Once my player's state machine gets to...
  9. S

    Check if id of instances is a certain object

    I want to check if my oPlayer instance can see another instance (oInputable), without beeing blocked by all other instances, grouped under the object oNotInputable. Both of these objects are children of the oSolid object that makes them all solid for the Player. To check this collision I use the...
  10. S

    Weird lengthdir problem

    I try to create a gun in my game that draws a line to the player, but when this line collides with a wall between the player and the gun the line should only be drawn to the wall. My code is the following: Create event: dir = 0 //direction the gun is facing collide = "" //Variable to store...
  11. B

    Legacy GM Platformer engine using collision_ functions

    I'm having a lot of troubles with making a simple platformer engine which is flexible and has no bugs. All the tutorials I found use place_meeting or instance_place, but these function are not good for me, because I want the player to be able to detect collision with the floor while standing in...
  12. F

    Collision Line Issue

    Hey guys! This OUGHT to be a simple, fix but it's making me crazy. I've got multiple copies of a "Terrain" object that draws terrain triangles instead of putting in a bunch of blocks. It's supposed to have a collision_line that destroys bullets when they cross the line it's drawing. The same...
  13. P

    Collision not being detected with collision_line at specific angles using length_dirx/y

    Hello everybody, Without getting into too much detail on what I'm trying to accomplish with the whole game, I'm creating a rail shooter where the player is able to jump from one rail to another. Using a custom-made collision script (that uses collision_line), the player object tells the rail...
  14. C

    Collision_line issues

    Hi guys. Ran into something that has been vexing me for the best part of a few hours. Done some looking into it and either I'm googling the wrong stuff or I just can't find something that is helping me. Basically I'm trying to make a space invaders game. Nice and simple for me to continue to...
  15. 2

    Get id from collision_line possible?

    How do you find the id of an object on a collision_line since it goes with an if statement, and probably doesn't set variables?
  16. A

    collision_line's collision coordinates

    Hello, I'm making a top down shooter and I need to know how to find the coordinates of collision line where it's hitting an enemy or a wall for example. Also I want to make room sides as a collision check end coordinates. Any example of the code would be great, thanks.