Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 The Invisible wall :?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Remm




PostPosted: Tue May 30, 2006 11:05 am   Post subject: The Invisible wall :?

Alright. I have my Final Gunner going very well atm, Multiple jets flying past at different speeds from random locations / sides. The bullets ALWAYS kill the jets when they contact, and all seems to be going well. I even have a full start menu. HOWEVER: Wink
Whenever the jets reach the middle of the screen, right above / around my tower, they explode for no reason whatsoever. The 'invisible wall' seems to change in size at times, always quite a bit to the right of the cannon. Any idea what the cause of this could be?

-----------|||||
-----------|||||
-----------|||||
_______|* |_______
| = invisible wall
* = tower
- = ignore these

I dont wanna put all my code up, since its coming close to my final project and i would rather no one use this as their own. I will put parts up if more information is needed, though.
Thanks, Remm
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue May 30, 2006 11:08 am   Post subject: (No subject)

well i cant really tell u whats going on unless i could actually see the code, if you could PM me it i might be able to help you (im not in class this semester)but i cant unless i see some code
Delos




PostPosted: Tue May 30, 2006 12:03 pm   Post subject: (No subject)

As SF82 has said, we can't do much without your code. That being said, you don't need to post all of it. Post only the part that you suspect is giving your problems. Usually, I would also mention that you ought to ensure it runs when we put it into Turing, but methinks that in this case the code would be a little too convoluted.
Either way - this sounds like a basic collision detection problem. Check your x- and y- values for the detection. It appears that your y-values have the wrong limits, hence they make the effective area of the tower stretch from the ground to the sky.
If you can't find the problem, post your collision detection code and/or any other code you think is buggy. And as for plagarism - by posting from your own account, that does provide some level of evidence that the code is in fact yours. Posting as a snippet usually safeguards you a bit more too, since any potential vagrants would be hard pressed to incorporate the code directly into their own projects.
HellblazerX




PostPosted: Tue May 30, 2006 4:41 pm   Post subject: (No subject)

Dude, I've already answered your question in a previous post. It was the same problem as last time, so I'm assuming that you haven't changed that portion of code.
Remm




PostPosted: Tue May 30, 2006 5:55 pm   Post subject: (No subject)

idk - what you said confused me at the time - very early in the morning. Then that whole topic spiraled into a process vrs procedure thing and i quit waiting for a answer there, since my main question, i answered myself within a few days (it was problem with delay). I had changed around the collision ditection, but that code basically works for it. if its above the number, but below the other number, exit ---> for both x and y. Basically makes a collision box around it to see if the bullet is acualy in. But i guess thats probably the problem. Thing is, i dont know any other way for collision detection Confused . i tried to figure out whatdotcolour but i couldnt find out how to incorperate it into the collision.
HellblazerX




PostPosted: Tue May 30, 2006 6:38 pm   Post subject: (No subject)

code:
for jetmove : 1 .. 70
     chance := Rand.Int (1, 20)
     Pic.ScreenLoad ("bigjet.left.bmp", jx1, jy1, picMerge)
     delay (55)
     Pic.ScreenLoad ("removejet.bmp", jx1, jy1, picCopy)
     exit when (tmovex > jx1) and (tmovey > jy1) and (tmovex < jx1 + 80) and (tmovey < jy1 + 32)
     jx1 := jx1 - 5
end for
Pic.ScreenLoad ("explosion.bmp", jx1, jy1 - 17, picMerge)

This piece of code was from what you posted earlier, and if I'm not mistaken, this code moves the plane from left to right. Now, after that for loop, you load up the explosion picture, meaning the plane exploded. It reaches this line only when the for loop ends, or in other words when your planes reaches the right side. However, in this line:
code:
exit when (tmovex > jx1) and (tmovey > jy1) and (tmovex < jx1 + 80) and (tmovey < jy1 + 32)

What you're doing here is exiting that for loop when the plane is directly over the tower, and thus you reache the line that loads up the explosion picture, and voila, your plane explodes. If you remove that exit condition and the explosion picture (I don't know why a plane would explode when it leaves the area), then your program should work just fine.
Remm




PostPosted: Wed May 31, 2006 7:47 am   Post subject: (No subject)

leaving the area = leaving the screen, so if they blow up by ending the for loop in such a way, you wont see the explosion. (10 mins later) intresting... i removed all the exit whens and it still blew itself up. AKA i Found out whats doing it! MY FOR LOOP ISINT BIG ENOUGH! Very Happy
god damn it - im stupid. No more invisible wall. Ty - you helped me notice it. Very Happy
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: