Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualszecs

Posted 27 June 2012 - 07:55 AM

Read my previous post again.
1. comparison that will be never true probably.

2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop. (Plus a sidenote, in cases like this ("increase some value until it reaches a certain value") I would use '<' or '<=' instead of '!='. Because it's pretty easy to make the mistake of jumping over the value even with integers, so that the statement will never evaluate to false.)
To solve this, you need to check and advance the motion in the main game loop or in the TimerFunc but only with the small, time dependant value (so not with a while, but an if statement).

3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS" section of the linked article).

It's hard to explain everything, because you seem to miss fundamental stuff in game programming.

#7szecs

Posted 27 June 2012 - 07:54 AM

Read my previous post again.
1. comparison that will be never true probably.

2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop. (Plus a sidenote, in cases like this ("increase some value until it reaches a certain value") I would use '<' instead of '!='. Because it's pretty easy to make a mistake even with integers, so that the statement will never evaluate to false.)
To solve this, you need to check and advance the motion in the main game loop or in the TimerFunc but only with the small, time dependant value (so not with a while, but an if statement).

3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS" section of the linked article).

It's hard to explain everything, because you seem to miss fundamental stuff in game programming.

#6szecs

Posted 27 June 2012 - 07:51 AM

Read my previous post again.
1. comparison that will be never true probably.

2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop.
To solve this, you need to check and advance the motion in the main game loop or in the TimerFunc but only with the small, time dependant value (so not with a while, but an if statement).

3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS" section of the linked article).

It's hard to explain everything, because you seem to miss fundamental stuff in game programming.

#5szecs

Posted 27 June 2012 - 07:51 AM

Read my previous post again.
1. comparison that will be never true probably.

2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop.
To solve this, you need to check and advance the motion in the main game loop or in the TimerFunc but only with the small, time dependant value (so not with a while, but an if statment).

3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS" section of the linked article).

It's hard to explain everything, because you seem to miss fundamental stuff in game programming.

#4szecs

Posted 27 June 2012 - 07:50 AM

Read my previous post again.
1. comparison that will be never true probably.

2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop.
To solve this, you need to check and advance the motion in the main game loop. And only with the small, time dependant value (so not with a while, but an if statment).

3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS").

It's very hard to explain, because you seem to miss fundamental stuff in game programming.

#3szecs

Posted 27 June 2012 - 07:48 AM

Read my previous post again.
1. comparison that will be never true probably.
2. you are doing all the movement in the while loop. So even if the while statement would evaluate to false, it would mean that the object will be instantly in the new position. But since the comparisons that will be never true probably, you are more likely get stuck in an infinite loop.
To solve this, you need to check and advance the motion in the main game loop. And only with the small, time dependant value.
3. Are you sure you don't want a continuously running game loop? If you want a continuously running game loop, then don't use a TimerFunc, but an IdleFunc with proper timing (for starters, see "Game Speed dependent on Variable FPS").

It's very hard to explain, because you seem to miss fundamental stuff in game programming.

PARTNERS