X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftitle.cpp;h=ae2eaaf30e320df74faa810fd608beef2763a556;hb=f1e15f44f709d6b4fa45e858dc12d7d701ae8ddc;hp=3ae54f67e2d08e3d5449553e7a51296bc426cbd3;hpb=60908c905544776c376421b8d3e12eeb936c068f;p=supertux.git diff --git a/src/title.cpp b/src/title.cpp index 3ae54f67e..ae2eaaf30 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -69,7 +69,7 @@ static Surface* logo; static Surface* img_choose_subset; static bool walking; -static Timer2 random_timer; +static Timer random_timer; static int frame; @@ -246,10 +246,10 @@ void draw_demo(float elapsed_time) controller->press(Controller::RIGHT); if(random_timer.check() || - (walking && (int) last_tux_x_pos == (int) tux->get_pos().x)) { + (walking && fabsf(last_tux_x_pos - tux->get_pos().x)) < .1) { walking = false; } else { - if(!walking && (int) tux->get_pos().y == (int) last_tux_y_pos) { + if(!walking && fabsf(tux->get_pos().y - last_tux_y_pos) < .1) { random_timer.start(float(rand() % 3000 + 3000) / 1000.); walking = true; }