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 Classic Chat / [SOLVED] Severe Lag from For Loop

Author
Message
LiamFTW
3
Years of Service
User Offline
Joined: 23rd Apr 2021
Location:
Posted: 23rd Apr 2021 03:49 Edited at: 23rd Apr 2021 22:04
I started to code this prototype racing game and Im trying to make my tires spin. Whenever I add in the for loop to make them spin, the game lags terribly. Is there anyway to fix this? Im running an RTX 3070 so theres no way its a graphics card issue

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Apr 2021 18:35 Edited at: 24th Apr 2021 18:39
This post has been marked by the post author as the answer.
i dont think you really want to rotate the tires ~360 degs each game loop:

ie, you're calling Sync() ~40 times per loop = the "lag".

try replacing the for/next loop completely with something like:

...and see if that's more to your liking? the +9 degs is arbitrary; rotate the rims/wheels by whatever you want each loop.
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
LiamFTW
3
Years of Service
User Offline
Joined: 23rd Apr 2021
Location:
Posted: 26th Apr 2021 17:24
That worked, thanks a lot! Also one more thing that isn't too big of a deal to me at the moment. Whenever you press A or D, the background jumps alot. Is there a way to fix that? Thanks

Login to post a reply

Server time is: 2024-11-21 18:14:02
Your offset time is: 2024-11-21 18:14:02