moveing a gui element (my setup should work!?)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Re: okay

Post by Ion Dune »

Another while loop would only be necessary in an algorithm or something, for example for calculating collision you might do something like this:

Code: Select all

while (collisionOccured()) pos.X -= 1 ;
But to do something like this:

Code: Select all

 while arrow key is down, move the character
You would write it as

Code: Select all

if (arrow key is down) move the character
because you already have a while loop. If you wrote it as

Code: Select all

while (arrow key is down) move the character
the program would halt (nothing would be drawn to the screen) and it would seem like it was frozen until you let go of the arrow key. This is because with while(), your program will never leave the loop until the expression (whats inside the parenthesis) is false. It will just keep moving the character and NOT drawing anything to the screen until you let go of the key.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Re: nope

Post by B@z »

3DModelerMan wrote:No, I mean where should I put another while loop when it's necessary.

..................
i told you didn't I?
forget that poop loops!
do you read what are we writing?

i've counted for you.
in my game ( it's almost done) there are 4 whiles in that! include the main loop.

one is file reading, one is checking the not dead enemy (while (enemy[nearest].isDead() && nearest < cNPC) nearest++;) and one for colliding.
THAT's ALL

so dont wanna do everything with loops!
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

While loops

Post by 3DModelerMan »

Yeah I forgot about the loops, I understand now.
Thanks :D .
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Post Reply