#Removing Enemies and bullets

33 messages · Page 1 of 1 (latest)

thin minnowBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

wild zodiac
#

Check which line that happened.

ivory depot
#

what you mean? here is line 73 ?

wild zodiac
#

Like what line of your code it was trying to execute when the error happened.

ivory depot
#

I have no idea where to check it I'm not much a programmer I'm still learning by myself

wild zodiac
#

Run in debug mode, when that dialog appears press Retry, then look into the Call stack window, click on the first entry that is from your code.

ivory depot
#

now I got the answer ^^

wild zodiac
#

Your code is the second entry, click it and you will be led to that position.

ivory depot
#

line 70

wild zodiac
#

So your i becomes out of bounds after you erased the enemy.

#

The next iteration is only of the inner loop which doesn't check i.

ivory depot
#

why this dont happen when depeting buller only not enemy at same time?

#

j would go out of bounds too

#

but dont happen to bullets

ivory depot
#

oh I see

#

there is a way to fix this?

wild zodiac
#

Well you change your code to match your expected logic.

ivory depot
#

I was trying to make bullet disappear when hit a enemy too and the same enemy disappear too but this is not working in the same loop because this.

wild zodiac
#

Think again how you can implement such functionality.

#

This is all your logic, C++ just does what you tell it.

ivory depot
#

I know..

wild zodiac
#

Here i is not being checked, so the most obvious thought is to make it actually be.

ivory depot
#

checked how?

#

check in reverse order give me a error too just not all time

ivory depot
#

sometimes I even go well but are this small silly quirks in every small detail in C++ make me stop too long to get what is

#

when in lua is all so direct and easy

wild zodiac
wild zodiac
ivory depot
#

I made this way I think is working fine now

wild zodiac
#

In Lua you would encounter the same kind of thing anyway.

ivory depot
#

I see

#

well I think is solved the problem now