Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / For loop in another For loop?

Author
Message
Serain
19
Years of Service
User Offline
Joined: 17th Jul 2006
Location:
Posted: 20th Jul 2006 10:02
Hi,
I've been trying to add collision to my little game, here is what I came up with:



I'm not sure this is a good way to do it, it just seemed logical to me. Anyway, when I try to run the program it just shuts down. I know this is the Sub that causes the program to crash because when I rem it out the rest works fine. I can't really see where the problem is so I'm starting to wonder if it's not the fact that I have a For loop in another For loop. I don't see why it shouldn't work but I'm out of ideas. Any help would be appreciated!

Thanks.
m2zt
20
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 20th Jul 2006 18:51
I think you should look at your code again. Im not going to tell you because you should be able to figure it out.

Hint look at your other subs and look at the one you showed us. Your code is fine but your just missing one thing.

Futurama 2008
Serain
19
Years of Service
User Offline
Joined: 17th Jul 2006
Location:
Posted: 20th Jul 2006 18:54
Thanks .
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th Jul 2006 21:40
It is perfectly acceptable to nest FOR...NEXT loops and I can see nothing wrong with the code you have written. So, my guess is ... it has to something else, elsewhere in your code.


m2zt
20
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 20th Jul 2006 22:10 Edited at: 20th Jul 2006 22:10
Everybody must be missing this. Dont know if you figured it out yet.

Pretty sure it will work now.

Futurama 2008
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Jul 2006 07:59
Putting RETURN at then end is irrelevant. EnemyBulletCollision: could just be a label and is not neccessarily the start of a subroutine (it probably is bit it doesn't have to be). So, the code should work regardless of wether or not there is a return at the end. It depends on how the rest of the code is structured.

Which is why I said:
Quote: "it has to something else, elsewhere in your code.
"



m2zt
20
Years of Service
User Offline
Joined: 12th Nov 2005
Location:
Posted: 21st Jul 2006 08:39
From looking at his code from another topic he started i assumed that he was using gosubs. So i figure he was missing a return and he even said he was using subs.

Quote: "I know this is the Sub that causes the program to crash because when I rem it out the rest works fine."



Heres the topic that he posted the code. Again assuming that this is the same game hes making.
http://forum.thegamecreators.com/?m=forum_view&t=84215&b=4

Futurama 2008

Login to post a reply

Server time is: 2026-07-06 17:12:12
Your offset time is: 2026-07-06 17:12:12