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 / Scrolling Background (Loop) ?

Author
Message
2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 19th Aug 2011 03:57
Hey guys,

Does anybody know how to do this?

I have one idea of the background being made up of several images and having them set up as sprites and when the screen is far enough tan image moves in place.

Does anyone else have an idea on how to do this?
Thanks.


Cheers.

God help me, Please.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 19th Aug 2011 05:45
The technique is sound. Check out the Santa's Bad Elf example from the AppGameKit projects folder, which does a great job of scrolling background sprites to create the effect of an infinite scroll.

I drink tea, and in my spare time I write software.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 19th Aug 2011 06:14
Here's a way to do this with UV scrolling. You can then bring in more images for variety/scene changes and move the sprites around to transition from one to another.



DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 19th Aug 2011 06:28
My first project is a scrolling shooter. I have 10 levels of parallax scrolling, which is overkill, I was just testing the performance. It's no harder to do than in DB Pro. Just odd to use sprites, rather than image commands for the backdrop.
The technique works, as I have a demo (work in progress) running using it. Although I confess to not reading the examples, and diving straight in myself. I have made my scroll loopable, which has presented more problems than I anticipated, although I knew having a looping level would make things a little more difficult.
My only gripe with it is the odd glitch, which shouldn't be there, in the scroll. I have since loaded the elf demo and noticed it in that too. Although the scroll is perfect, it occasionally jitters. I wonder why, although this is not a new thing for me. Many languages have had this issue, AMOS, DB, DB Pro, and now AppGameKit have all had this untreatable glitch with scrolls.
But I am waffling, my scroll involves 2 sprites. I change the images as I move along them. So I start on sprite 1, and when I get to sprite 2, I change the images and move back to sprite 1. As long as you shuffle the images correctly you have a scroll.

http://s6.bitefight.org/c.php?uid=103081
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 19th Aug 2011 14:07
is scroll glitch dependent on the fps set by SetSyncRate() ?
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 19th Aug 2011 18:16
I am unsure. I have it set at 60 fps at the moment. I haven't looked into setting the framerate to 0 and using timer to update as yet. I'm not even sure if it is needed with AppGameKit, as it may work differently to DB Pro.
It would be worth knowing if AppGameKit actually pauses to get the correct fps in the same way DB does or not.

http://s6.bitefight.org/c.php?uid=103081
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 19th Aug 2011 18:44
timer based movement is essential.

i noticed some jitter in scrolling when using 60fps. setting fps to 200 seems to have solved the problem for now!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2011 00:46
A higher fps will reduce the jitter as it becomes imperceptible to the human eye. However mobile devices usually aren't able to go over 60fps. I never found the source of the jitter although it's a lot better than when we tried using vsync. I can only guess that it is some occasional delay in the GPU flipping the backbuffer.

Quote: "It would be worth knowing if AppGameKit actually pauses to get the correct fps"


Yes, the AppGameKit has two options, a sleep (default) or a busy wait loop (may be more accurate), controlled with the second parameter to SetSyncRate().

Login to post a reply

Server time is: 2024-04-18 12:51:41
Your offset time is: 2024-04-18 12:51:41