Problems with input? why am i moving so fast when i shouldt

Florian,

thanks for your reply! that actually seems very logical - the loop runs so
fast my finger is still on the botton. but it also doesnt make sence, ive
done a much smaller “game”, the second tutorial at cone3d.gamedev.net. its
just a simple bitmap that moves around the screen, and im pretty sure that
this stuff didnt happen in that app. so i dont see why this is happening in
mine =(. anyway, i tried implementing your code, but its not working. please
tell me what im doing wrong. heres the source :

while(data.done == 0) //main game loop, while we havent quit (done stays 0 

till we x out)
{

	//do
	//{



	time = SDL_GetTicks();

	Draw_Backgrounds();						//first draw the background over the old objects

	Move_Pac();

	Draw_Objects();				//now draw the objects (gloves and ball and score) in 

the new spot

	//}
	while (SDL_GetTicks() - time > 1000/60);

}

i dunno if what you did was a typo, but ive never seen a while loop by
itself, what does this do?? as you can see i tried doing other things, like
putting a do at the top (is that what you meant???, i think your message got
cut off or something ?)

thanks for your help!!

ps- COOL WEBSITE!!!i LOVE the supermario battle game, very clever. maybe you
could help me with my tile problem, that i just asked about on this group? i
read your tutorial, but unfortunately it didnt cover moving tiles slower
then one tile at a time - or at least i dont think it did. maybe i should
have read the downloadable version? i dont know. also, your tutorial seemed
much more complicated then mine. my collision detection is very simple, its
like one line for each movement. thats prolly why im having so many
problems._________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ? get it now!
http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/

while (SDL_GetTicks() - time > 1000/60);
is wrong
it should be
while (SDL_GetTicks() - time < 1000/60);

i think your getting an infinite loop otherwise.

the downloadable tutorial is exactly the same as the online version.
the things it covers are one level higher. things like a frame break or
how you handle input aren’t covered, because these things aren’t very
hard to get right.

Graveyard Filla wrote:> Florian,

thanks for your reply! that actually seems very logical - the loop
runs so fast my finger is still on the botton. but it also doesnt make
sence, ive done a much smaller “game”, the second tutorial at
cone3d.gamedev.net. its just a simple bitmap that moves around the
screen, and im pretty sure that this stuff didnt happen in that app.
so i dont see why this is happening in mine =(. anyway, i tried
implementing your code, but its not working. please tell me what im
doing wrong. heres the source :

while(data.done == 0) //main game loop, while we havent quit (done
stays 0 till we x out)
{

//do
//{

time = SDL_GetTicks();

Draw_Backgrounds(); //first draw the background over the old objects

Move_Pac();

Draw_Objects(); //now draw the objects (gloves and ball and score) in
the new spot

//}
while (SDL_GetTicks() - time > 1000/60);

}

i dunno if what you did was a typo, but ive never seen a while loop by
itself, what does this do?? as you can see i tried doing other things,
like putting a do at the top (is that what you meant???, i think your
message got cut off or something ?)

thanks for your help!!

ps- COOL WEBSITE!!!i LOVE the supermario battle game, very clever.
maybe you could help me with my tile problem, that i just asked about
on this group? i read your tutorial, but unfortunately it didnt cover
moving tiles slower then one tile at a time - or at least i dont think
it did. maybe i should have read the downloadable version? i dont
know. also, your tutorial seemed much more complicated then mine. my
collision detection is very simple, its like one line for each
movement. thats prolly why im having so many problems.


FREE pop-up blocking with the new MSN Toolbar ? get it now!
http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl