Jump to content
  • Advertisement
Sign in to follow this  
Infinite_Daremo

Objective C: Comparison Operators?

This topic is 3366 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just realised i posted this in game instead of general.... oops. Ok, i have the update of an entity as follows:
-(void) doUpdate {
	if(m_bActive)
	{
		if( m_direction == _South )
		{
			m_position.y++;
						
			if( m_position.y >= ( [VIZ m_iScreenHeight] + 32 ) ); // Change to image height
			{
				m_direction = _North;
			}
		}
		else
		{
			m_position.y--;
			
			if( m_position.y <= ( 0 - 32 ) ); // Change to image height
			{
				m_direction = _South;
			}
		}
	}
}

No matter what the value of m_position.y it executes the if statement. Is this simple test somehow different in Object C? Ive found tutorials showing the same usage. Im baffled. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Its an instance variable, a CGPoint in particular which contains two CGFloats which are just typedefs for floats. Ive debugged and by any logical sense this shouldNT be triggering.

Share this post


Link to post
Share on other sites
Quote:
Original post by Infinite_Daremo
Ok, no more 16 hour coding spree's for me. Stupid little semi colons. See if you can spot them :(

Yep. Classic C (and all its hellion spawn [smile]) bug!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!