Simple collision detection problem

Stuck? This is the place to go to get and give help.

Simple collision detection problem

Postby Brian.Washechek » September 16th, 2014, 12:14 am

I would guess that my answer would be in the example projects that come with DSGM, But I spent a while constructing this question and typing my inquiry that addresses my question, so thought I would go ahead and post my question.

The question is expressed by the my uploaded image.

If the answer to my question is in the example projects that come with DSGM just say so.
Attachments
Force Disruptor.zip
(4.48 MiB) Downloaded 263 times
big X.bmp
big X.bmp (1.27 MiB) Viewed 8461 times
Last edited by Bobbyloujo on September 16th, 2014, 4:33 am, edited 2 times in total.
Reason: Totally unnecessary rage. Don't post personal info of people you don't like.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby Buck_7 » September 16th, 2014, 3:01 am

Wow, sounds like you had a rough time. I suppose the best you can do is to let go of the past and start afresh like your doing now trying to recreate the game.

Anyways, from looking at the pictures you've posted, I can only guess so much since you did not actually ask the question. But it looks as though you want to know when two lines intersect?
Last edited by Buck_7 on September 16th, 2014, 4:03 am, edited 1 time in total.
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: Simple collision detection problem

Postby Brian.Washechek » September 16th, 2014, 3:48 am

Yes, Ha-ha. The image is supposed to suggest it, but I suppose I should learn to communicate. It needs to be a boolean function named intersection with (line1.x1, line1.y1, line1.x2, line1.y2, line2.x1, line2.y1, line2.x2, line2.y2) as numerical input variables. That's just an example of how I'm thinking of plugging it in. It's pseudo-code, I guess.

I believe this is how I constructed the original, but if you have a better suggestion, I'm listening!
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby Buck_7 » September 16th, 2014, 4:04 am

What exactly are those lines supposed to be? How are you planning on using them?
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: Simple collision detection problem

Postby BLsquared » September 16th, 2014, 3:55 pm

I was thinking the same thing the other day.
Think of using this, where Line1 is a player's side, and Line2 is a collision BG.
Just a thought.
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Re: Simple collision detection problem

Postby Buck_7 » September 18th, 2014, 9:06 pm

That looks complex O_O
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: Simple collision detection problem

Postby Brian.Washechek » September 23rd, 2014, 12:56 am

YoshiInAVoid, that's awesome! It's just what I was looking for, I think!!!(21!!(?)
Last edited by Brian.Washechek on September 23rd, 2014, 6:32 pm, edited 3 times in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby Brian.Washechek » September 23rd, 2014, 5:23 am

I went through the DSGM examples folder, but was unable to find a program I could plug this into...

I understand the math. And I understand the code. What I fail to understand is how I plug this into DS Game Maker. I could do it except part 1 of my game series was not written in DS Game Maker, so I'm not familiar wit it.

Does anyone know an extremely simple DS Game Maker game that uses http://alienryderflex.com/intersect/ that I could fool around with? I'm looking for something with the levels of simplicity that the examples included with DS Game Maker have.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby Brian.Washechek » October 20th, 2014, 5:58 am

Can anyone tell me how to refer to the input variables (double Ax, double Ay, double Bx, double By, double Cx, double Cy, double Dx and double Dy) and then the output variables bool lineIntersection, double *X and double *Y in a DS Game Maker?

I understand that code, but it's C. I don't know how to apply C code to DS Game Maker. It would be awesome if there was a way to run C code n DS Game Maker.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby paulolol » October 20th, 2014, 5:49 pm

I'm not very talented at DSGM, but I think it can help you :

In the object's algorithm, you can find in "Control" functions something called "Execute code"

I don't know if it works with C or DBAS (or both) but I know that you can use all variables (as your boolean) through the rest of your algorithm

I hope it will help you
God wrote:Paulolol is da best !!!

My site (still in french)
User avatar
paulolol
 
Posts: 15
Joined: September 28th, 2014, 1:21 pm

Re: Simple collision detection problem

Postby Nobody » October 20th, 2014, 9:36 pm

If you use the "Execute code" action this is probably the most common way. However, the execute code action prefers DBAS syntax, but you can use C. If you do use C note some differences that won't compile right. As long as you follow the below example when it comes to block statements and parameters you should be fine though:

what won't work:
if (true)
{
}
else
{
}

what will work:
if(true){
}else{
}

alternatively you can use the built in scripts feature in DSGM where you can chose to use C or DBAS.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: Simple collision detection problem

Postby Brian.Washechek » October 21st, 2014, 1:32 am

Cool, I'm very familiar with that. Part 1 of Force Disruptor was coded in VB.. It wasn't C, but it still gave me a feeling of actual coding.

I love that DSGM coding language example. Do you know where can I read about the language that makes up the "Execute code" action?

Let me guess.... Search for DBAS examples? I would prefer C, but I'll go with DBAS...
Last edited by Brian.Washechek on October 21st, 2014, 3:42 am, edited 1 time in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby paulolol » October 21st, 2014, 8:21 am

There is a DBAS forum here : viewforum.php?f=9
God wrote:Paulolol is da best !!!

My site (still in french)
User avatar
paulolol
 
Posts: 15
Joined: September 28th, 2014, 1:21 pm

Re: Simple collision detection problem

Postby Nobody » October 21st, 2014, 10:37 pm

I recommend using C instead but feel free to use DBAS functions though. This link will give links to DBAS syntax along with some DBAS functions. Also, another way to figure out some functions is looking at the action editor. Here you can see some uses of different DBAS functions along with other PAlib functions. While you're there, feel free to create actions for snippets of code you use most often.

Last but not least open up the compile temp folder and you can see all the source files and see some of the underlying functions, variables, and code that helps DSGM work
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: Simple collision detection problem

Postby Brian.Washechek » October 25th, 2014, 11:56 pm

"This link will give links to DBAS syntax along with some DBAS functions." is not a link. Chances are that I'm misunderstanding.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: Simple collision detection problem

Postby Bobbyloujo » October 26th, 2014, 12:22 am

I'm guessing this is the link he meant to post: http://dsgamemaker.com/help/language.php
Image
User avatar
Bobbyloujo
Site Admin
 
Posts: 1385
Joined: December 30th, 2010, 8:40 pm
Location: USA


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron