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.

Newcomers AppGameKit Corner / Landscape sprite freezing

Author
Message
Khadin
9
Years of Service
User Offline
Joined: 13th Feb 2015
Location: Nottingham
Posted: 17th Apr 2015 21:25 Edited at: 17th Apr 2015 21:30
Hi guys.

This is giving me a headache.

The code:



It lays the landscape, but then the frames drop from 60, to 30, and then the game eventually stops working. Sometimes it's possible that i get past the bit where it stops producing landscape, and the frames pick back up, and the screen is more responsive again.

Khadin
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 17th Apr 2015 22:55 Edited at: 17th Apr 2015 23:00
How many times are you calling that function? If it is more than once, are you deleting the sprites or either setting them not active? Also, if you are calling this function more than once then you are reloading those images unnecessarily and using up memory. You can set up an image loading function and only call it once to avoid that.

Another thing, you are trying to enable physics on an image and not a sprite. Here are some changes I made:




You could also do this with setspriteposition:



It's handy if you want to create more sprites.
Khadin
9
Years of Service
User Offline
Joined: 13th Feb 2015
Location: Nottingham
Posted: 17th Apr 2015 23:14
I've used your code, and i'm getting the same problem sadly. I'll just lay it manually, spent enough time on this.

Thanks for helping though.

Khadin
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 17th Apr 2015 23:33
It's possible that there is a problem somewhere else in your code or maybe a different program that is slowing down your computer. It is difficult to try to diagnose anything with limited information.

Login to post a reply

Server time is: 2024-03-28 10:44:39
Your offset time is: 2024-03-28 10:44:39