Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Scrolling Horror

4: Adsense
  • You cannot reply to this topic
3 replies to this topic

#1 willpowered   Members   

534
Like
5Likes
Like

Posted 04 May 2013 - 11:14 PM

*
POPULAR

public void scrollUp() {
	if (scroll_index <= 0) return;
	scroll_index--;

	refreshContentsPosition();
}

public void scrollDown() {
	if (scroll_index >= contents.Count() + (2 * 6) - 12) return; //todo: make sure this is the correct index, once you add more levels.
	scroll_index++;

	refreshContentsPosition();
}

 

The code speaks for itself. Obviously, upon review, it was not the correct index.

 

Dunno what came over me when I wrote that.



#2 TheChubu   Members   

9323
Like
3Likes
Like

Posted 05 May 2013 - 12:10 AM

if (( 2 * 6) == 12) // Checking if 2 * 6 actually is 12. No one can be sure enough.
{
return;
}
:P

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#3 Dim_Yimma_H   Members   

557
Like
0Likes
Like

Posted 09 May 2013 - 08:31 AM

(2 * 6) - 12

I don't know what's worst, it doesn't look all correct, but does nothing ...so did the code work?



#4 Sik_the_hedgehog   Members   

3002
Like
0Likes
Like

Posted 10 May 2013 - 10:22 PM

Basically it'd let the scroll index go as far as the last entry, but since that's what's at the beginning of the scroll (when you'd want the last entry at the end), this would result in the scroll going far beyond its limit. The calculation was supposed to compensate to get the correct limit, but obviously that's not what happened =P

 

At least if I'm understanding right.


Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.