help from loop

Hello! Good night everybody!

I am "trying" to develop a fighting game in SDL2 c ++, I have the following problem:

I have a 10 position loop where each position repeats 4 EXAMPLE: in position 0 repeats 0 0 0 0 in position 1 repeats 1 1 1 1 and so on to number 9,

what i want is that when i get to a position i choose Example: if i choose position 1 i perform an action but only the first time i

repeated number 1 the other time number 1 is repeated do nothing.

I can not solve this problem I do not know why, since I've done something much more difficult and complex than that, I think I'm not thinking straight kkkk.

See an example of a loop ... not the one I'm using is no longer the same logic.



if (currentFrame == 9){
currentFrame = 0;
}else{

if (slow == 4){
currentFrame++;
slow = 0;
}
slow++
}
Honestly, I have no idea what you're saying.

I have a 10 position loop where each position repeats 4 EXAMPLE: in position 0 repeats 0 0 0 0 in position 1 repeats 1 1 1 1 and so on to number 9,
What does "repeats 0 0 0 0" mean? What's being repeated, and how?

what i want is that when i get to a position i choose
Please, could you use consistent grammar, at least for the word "I"? In a programming context people expect that the lower case 'i' refers to an index, so it's terribly confusing to see the word "I" in lower case when talking about a loop.

if i choose position 1 i perform an action but only the first time i repeated number 1 the other time number 1 is repeated do nothing.
What's a position, and how do you choose one? Is it related to the "position" you mentioned in the sentence "I have a 10 position loop..."? If so, then it's strange to talk about choosing an iteration of a loop.

See an example of a loop ... not the one I'm using is no longer the same logic.
How is the code you posted a loop?
What's anyone supposed to understand from this snippet?


Explain more thoroughly what you're doing and why, otherwise no one will be able to help you.
See an example of a loop ... not the one I'm using is no longer the same logic.


In addition to @helios' comments, why would you want us to comment on code in which the logic has changed? "Why doesn't my code work? Look at this obsolete snippet from last week and tell me."
I don't think I explained what I wanted to say, sorry ... I used the translator to translate.
I will try to explain a little more simply:
if (currentFrame == 9) {
currentFrame = 0;
// When 'currentFrame == 1', perform an action only once
// In this loop 1 is repeated 4 times, I need to perform the action only on the first 1
} else {
if (slow == 4) {
currentFrame ++;
slow = 0;
}
slow ++
}
Topic archived. No new replies allowed.