Advertisement

HELP!!!

Started by November 18, 2001 06:27 PM
3 comments, last by DarkHunter 23 years, 3 months ago
what is wrong with this code!!!!
  
if(keys['S'] && !sp)
{
	sp = true;
	spin = !spin;
}
if (!keys['S'])
{
	sp = false;
}

if(spin = false)
{			// Slow Down if not in spin mode

	

	if (xspeed > 0.0)			
	{
		xspeed -= .0005;				
	}
	if (yspeed > 0.0)
	{
		yspeed -= .0005;
	}
	if (xspeed < 0.0)
	{
		xspeed += .0005;
	}
	if (yspeed < 0.0)
	{
		yspeed += .0005;
	}
}
	xrot += xspeed;
	yrot += yspeed;
  
if in spin mode, it countinously spins, if spin is false it has to slow itslef down, simple as that! but it wont work. Edited by - DarkHunter on November 18, 2001 7:31:54 PM
It should be (spin == false).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
One of the oldest and simplest problems from the looks of it:

if (spin = false)

should be

if (spin == false)
or
if (!spin)

easy mistake to make - hard to spot!

EDIT:

Fruny - you beat me to it by 59 seconds!

Edited by - Enigma on November 18, 2001 7:35:50 PM
Well, since you aren''t saying how exactly it isn''t working, I can only guess that your problem is
if(spin = false)

This should be spin == false. (assuming you just copy/pasted it and didn''t make a mistake typing in your code here)
I FEEL SO DUMB! thx

This topic is closed to new replies.

Advertisement