Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Sprites moving faster each time change the scene.

Author
Message
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 11th Sep 2020 11:06 Edited at: 11th Sep 2020 11:09
Hi.

I made a game in Classic long time ago in 2018 and I figured I port the game over to Studio and this time use the level editor, just for fun.
the game involve sprites moving on the screen and as I was porting over the game to Studio, I have noticed the moving sprites are moving faster each time I switch back and forth between the scenes.
When I debug it, the numbers like speed, position, frame rate, time are correct yet the sprites are moving noticeable faster each time a change the scene and can not figure out what the problem is.
After waiting some time, the sprites slow back down to normal (real) speed on their own.

I don't have this problem in the old 2018 version of AppGameKit Classic, but I do experience this problem in the current version of Studio and Classic with both OpenGL and Vulkan renderers and on all platform, Windows, Android, Web, macOS, iOS.

I am uncertain if it a bug or an error in my code.
I have attached a sample project reproducing the problem.

For those who don't want to download the project, here is the code:



Any idea what is causing this weird behaviour?
Thanks.

Attachments

Login to view attachments
Heavens
8
Years of Service
User Offline
Joined: 10th May 2015
Location:
Posted: 11th Sep 2020 19:10
You need to change the for loop where you are removing the candles to this:



You are invalidating the i index counter
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 11th Sep 2020 20:15
Thanks a lot, haven't thought of that. Weird I did not had this problem in the old classic project.
TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 12th Sep 2020 06:12
You could also use candies.length = -1
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 12th Sep 2020 09:44
Thanks. I`ll keep that in mind.

Login to post a reply

Server time is: 2024-04-25 16:10:16
Your offset time is: 2024-04-25 16:10:16