Computer Science Canada Why can't I delete my bullets? |
Author: | GlobeTrotter [ Sun Jun 20, 2004 4:26 pm ] | ||||
Post subject: | Why can't I delete my bullets? | ||||
The section
Should delete the bullet that hits the wall. I get an array out of range error. How should I properly do this? |
Author: | naoki [ Sun Jun 20, 2004 6:12 pm ] |
Post subject: | |
i haven't run your program, but it looks like your array is out of range because ... your array is out of range. see your flexible array? it starts from 1 to a variable. see your "for i" ? it also goes from 1 to something. good start. but notice your "k" statements? you change values at "k" to values at "k - 1". if the first bullet happens to go off the screen and doesn't hit an enemy, then you're attempting to set bullet (1)'s values to bullet (0). since your flexible array doesn't have any values at (0), it messes up. hope it helped |
Author: | GlobeTrotter [ Sun Jun 20, 2004 10:06 pm ] | ||
Post subject: | |||
Okay I managed to fix that, but I've got another problem. Why doesn't my drawfill command work properly? Why doesn't it fill in the tank? For some reason, it fills in the whole area. |
Author: | Tony [ Mon Jun 21, 2004 12:10 am ] |
Post subject: | |
could it by any chance have something to do with you commenting out the circle to be filled |
Author: | this_guy [ Mon Jun 21, 2004 9:27 am ] |
Post subject: | |
wow....great code.... couple things... sometimes the bullets travel slower than the tank, and also the game's really slow on my comp. |
Author: | GlobeTrotter [ Mon Jun 21, 2004 2:43 pm ] | ||
Post subject: | |||
tony wrote: could it by any chance have something to do with you commenting out the circle to be filled
No it doesn't. That circle is for testing purposes only. I want a filled in rectangle. Turing's drawfillbox does not allow you to rotate it. If I uncomment that circle, I get a filled in circle. I'm not sure why turing does not fill in the rectange only.
This is basically what I want to happen. I want a filled in rectangle, and I know it should work since it works in this example. I don't know why it doesnt work in my other example. |
Author: | Cervantes [ Mon Jun 21, 2004 3:02 pm ] | ||
Post subject: | |||
tony.. you should have gotten this one. you too globe. ignoring all the code for bullets and movement and such and looking purely at the graphics code:
move drawfill after all the other drawing stuff. |
Author: | GlobeTrotter [ Mon Jun 21, 2004 3:27 pm ] | ||
Post subject: | |||
oops, that was stupid. Thanks. I've got another question now. How can I make it so that when I hold down enter my game doesn't freeze. I understand why it freezes in my next example, I simply can't think of another way to accomplish the same task.
|