Why my game is so slow

when i press the button, the map reload so slow… and when i press many time the buttons right/left is laggy

sandbox_1d.aia (8.9 KB)

Were you expecting the trees to move by themselves?

Your Clock Timer event was empty, so all you had working was the left and right button Touch Up events.

Sample run

Those buttons did not look slow to me, as long as I kept pounding them.

Hi, thanks for the reply.
Here’s a quick summary:
The first thing I tried was having the left/right buttons simply change pos_x while the timer handled map rendering; that takes up to a full second on my Redmi redraw the map. Then I tried calling render_map() directly when the buttons are clicked (not using timer). That’s faster—taking half a second—but if I do many click rapidly, the calls stack up, and it takes several seconds to redraw the map. What do you recommend? The goal is to make navigating the map less sluggish. Thanks yoy


Hmm, I tried using the timer and downloading the app to my phone—meaning I didn't use the AI2 Companion—and it works better, though it's still a bit slow.

This kind of animation is usually done using the Canvas.

Search this board for 'Flappy' to see sample side scrollers.

To set the scrolling to automatic, you would need an extra global variable to set the speed (positive or negative change to your global index number per Clock Timer cycle.)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.