Information

Author:
    Kenon
Rating:
    7.8 (5 votes)
Type:
    Example
Language:
    GM 6
Reviews:
    None
Submited:
    September 08, 2007
Dev - DB/form (refering to updated - check code)
Download:
    DOWNLOAD (273)
Dev - make AJAX
Screenshots (0)
Dev - Also, on form submission, use GD to resize the image as a new thumbnail file
There were no screenshots provided
Dev - In the submission form, you can now upload a banner image
collision_check_segments
This is another example inspired by a fellow member, this time marbs.

This time, it's basic. In a chance where you need to check if segments collide, as in triangulating polygons with concave parts, you'll have to find if a segment intersects another one.

By using simple algebra, I managed to create what I believe is a bug-free code.

It is possible for me to find the X and Y values, but then there would be the problem of what would happen if there was no collision.

Don't be suprised about how simple this is. It does what it was programmed to do.

To clear the lines, press space.

It's very basic, and anyone could have made it, but I haven't seen any example like this. So I took an initiative.

No need for credit.

EDIT: if the line is the same, it returns false. I did that for marbs, but you can easily change that.


Target platforms:



Dev - Warning
Dev - After editing rating, make rating display change
Dev - When editing, update "edited" column
Dev - Restore deleted comments
Dev - Display deleted comments if mod (hidden, then with dropdown)
Dev - After deletion or during edit, make rating dropdown appear again
Dev - Stricter rating rules. Prevent user from rating again
Dev - Pages
Dev - Reporting
Kenon submitted an example :o
Posted by Obelisk September 08, 2007 22:28 - 5.7 years ago
| [#01]

another* example
Posted by noshenim September 08, 2007 22:42 - 5.7 years ago
| [#02]

You broked my combo. :l
Posted by Obelisk September 09, 2007 3:00 - 5.7 years ago
| [#03]

I'm pretty sure your code could be simplified further, but good effort anyways.
Posted by Juju September 09, 2007 4:46 - 5.7 years ago
| [#04]

Yeah, I don't need most of the variables I created aside from to assemble the slope variable and the y-intercept variable, which is used to solve the x location of collision. It just makes it much easier to assemble.
Posted by Kenon September 09, 2007 13:47 - 5.7 years ago
| [#05]

Thanks for making this, I havent found any bugs with it...yet ;)
Posted by marbs September 09, 2007 17:01 - 5.7 years ago
| [#06]

Simple, effective, original. That's an acronym for SEO. Well, that didn't make sense, but this score does. 9/10.
Posted by Crane-ium September 10, 2007 2:21 - 5.7 years ago
| [#07]

pretty simple example. basic algebra :P

still, it works. 7/10
Posted by Alert Games September 10, 2007 21:29 - 5.7 years ago
| [#08]

Simple, yes. Effective, halfway. Original, no.

Ok. My explanations:
Simple: Yes, all you have to do is use the script.
Effective: Halfway. It returns whether the lines collide, but does not tell where, unlike most other such examples.
Original: No, Many people (myself included) have made such things.
Posted by Gamer3D September 10, 2007 23:21 - 5.7 years ago
| [#09]

FAIL
Posted by sirxemic September 11, 2007 12:27 - 5.7 years ago
| [#10]

@AlertGames: "basic algebra :P" I acknowledged that

@Gamer3d: I can easily make it where it return the x and y coordinate. Just I was debating on whether to return it via one script to a string, or to make two scripts that return x or y.

And I haven't seen something like this in a while. I know it's not original, as marbs just needed something to implement into his game. It workes.

@Cat: WTF. Strange.

I hope you didn't alter it. Or wait... did I fix that?

I really don't know how that could happen.
Posted by Kenon September 11, 2007 16:49 - 5.7 years ago
| [#11]

Quote
I hope you didn't alter it.
Nope. And I redownloaded it and tried it again, and the result was the same.
Posted by sirxemic September 12, 2007 9:51 - 5.7 years ago
| [#12]

Just make the first one straight vertical and make the second one intersect it, and you will get that.
Posted by sirxemic September 12, 2007 9:52 - 5.7 years ago
| [#13]

@Kenon - I've made this exact same thing before - there are a lot of things that give false positives - parallel lines also give that they do not collide. ^_^
Posted by DesertFox September 12, 2007 15:04 - 5.7 years ago
| [#14]

I made a GM7 extension that includes this and more...

If you want to try it, it's here: http://gmbase.cubedwater.com/image_links/cache/ex_124.png
Posted by Gamer3D September 12, 2007 21:25 - 5.7 years ago
| [#15]

Nice one, jackass, you posted the link to a graphic.
Posted by Juju September 13, 2007 12:29 - 5.7 years ago
| [#16]

xD!!!!!!!!!!111
Posted by noshenim September 29, 2007 21:22 - 5.6 years ago
| [#17]

lol. This is pretty nice

9/10
Posted by Cpsgames March 10, 2008 20:18 - 5.2 years ago
| [#18]

Nice, I like it, I may be able to get some use out of this :) 8/10
Posted by RaixSpeedX July 24, 2008 19:26 - 4.8 years ago
| [#19]

Recent Activity
 
Active Users (0)