|
Title: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: Siegfreide on October 19, 2013, 09:34:06 AM I want to know if the GML code "collision_line" logs only the first object that the line collides with, or if it logs all collisions along the line.
If it is the latter, is it possible to determine the id of not the first object in the collision line, but the second or third? I'm trying to build a darkness script that first fills the room with "darkness objects" (done), then check if the player is within a certain distance and, if so, decreases their alpha incrementally based on distance to player from 1 to zero (done). My problem is that I'm having trouble getting the "wall darkness" to interact correctly, because I check collision_line(par_wall). Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: nikki on October 19, 2013, 06:06:48 PM I am not a GML guy but you say "I want to know if the GML code 'collision_line' logs only the first object that the line collides with, or if it logs all collisions along the line."
that leads me to think the output is logged somewhere? a console,logfile or whatever? if that's the case you could just check the result of your function ? but maybe It's me Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: Siegfreide on October 19, 2013, 06:10:41 PM Perhaps "logs" is the wrong word. When you "collision_line" it checks whether any instances of a given object collide with a given line, and if there is it returns the id of one of those instances. The returned id is always the first object your looking for in the line, But I'm curious if it stops the line at the point of collision, or if it completes the line and takes note of all the collided objects ids.
Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: mokesmoe on October 20, 2013, 02:49:16 AM I don't know exactly how it works internally, but you can't get any other output from it.
What are you doing with the collision_line? Could you use "with" with the wall you are on top of and then use ignore self? Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: nikki on October 20, 2013, 08:27:11 AM I looked it up for you in the manual (http://gamemaker.info/en/manual/403_04_collision)
Quote When planning motions or deciding on certain actions, it is often important to see whether there are collisions with other objects at certain places. The following routines can be used for this. All these have three arguments in common: The argument obj can be an object, the keyword all, or the id of an instance. The argument prec indicates whether the check should be precise or only based on the bounding box of the instance. Precise checking is only done when the sprite for the instance has the precise collision checking set. The argument notme can be set to true to indicate that the calling instance should not be checked. All these functions return either the id of one of the instances that collide, or they return a negative value when there is no collision. Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: sambaylus on November 11, 2013, 01:12:26 AM ...and here is a nice little script that will store ALL instances on that line and store them into a ds_list for you!
http://www.gmlscripts.com/script/collision_line_list Title: Re: Siegfreide's Conundrum 02 - Does collision_line log ALL collisions along line? Post by: Siegfreide on November 11, 2013, 08:56:24 AM Awesome! Great find, thank you for sharing! This is going to help me tremendously.
|