Jump to content

Loop Bug

- - - - -

  • Please log in to reply
2 replies to this topic

#1
FenixEden

FenixEden

    Newbie

  • Members
  • Pip
  • 6 posts
Okay, first of all, here's a explanation of what I'm trying to do :
I want to refresh an image like a Frame that is refreshed.
It refreshes it 25 times after a click on a label (for instance : South)
It does so because I used a loop like for example
(when button clicked)
private: System::Void GoNorth_Click(System::Object^ sender, System::EventArgs^ e) {
if (WhereAim != "North") {
LeggingPath = "C:\\Images\\SQSNPants.png";
TorsoPath = "C:\\Images\\SQSNShirt.png";
HeadPath = "C:\\Images\\SQSNFace.png";
WeaponPath = "C:\\Images\\SQSNSword.png";
ShieldPath = "C:\\Images\\SQSNWoodShield.png";
WhereAim = "North";
}

//That upper part is okay

CharY2 = CharY -25;
if (CharY2 < 0) {
CharY2 = 0;
}
for (CharY; CharY > CharY2; CharY--) {
RefreshMap(false);
}
RefreshMap(true);

}
}

The bug I have is neither compilation, neither runtime.
It affects CharY the final value (25) : 25 times instead of incrementing it each time by one.

*** Found out... but still there's a problem described in latter post.
////
Other stuff about the code :
RefreshMap(True) refreshes all the map while RefreshMap(False) calls only the character draw (it is partial, in facts)
RefreshMap's testing tells us that in this one void fucntion : I got the real 25 values (1,2,3,4,5 [...])
But in the SpriteImage->Paint([...]);
There is that bug i described upper,
See, it seems that in the first void function everything is okay while in the sub sub function it affects 25, 25 times in a row to my CharY value...

#2
FenixEden

FenixEden

    Newbie

  • Members
  • Pip
  • 6 posts
Okay, let's say I found the bug solution two posts lower.
What if Each Time I click on it, the speed of the process is slower?
What would you do about that?
(I needed a Refresh()).

#3
Momerath

Momerath

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 242 posts
Wrong forum, this is C# not C++




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users